Skip to content

Instantly share code, notes, and snippets.

View le0park's full-sized avatar
🎯
Focusing

Junyoung Park le0park

🎯
Focusing
View GitHub Profile
@le0park
le0park / tmux.conf
Last active October 25, 2020 11:31 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@le0park
le0park / add_blocking_ip.sh
Created May 15, 2019 01:50
Block ip with text list file in ubuntu
while IFS='' read -r line || [[ -n "$line" ]]; do
echo "Blocking IP: $line..."
iptables -A INPUT -s $line -j DROP || { echo 'Blocking failed.' ; exit 1; }
done < "$1"
@le0park
le0park / kill_processes.sh
Created April 24, 2019 03:17
Kill many instances of a running process
for pid in $(ps -ef | awk '/some search/ {print $2}'); do kill -9 $pid; done
@le0park
le0park / remove_last_word.sh
Created April 23, 2019 09:02
Remove character from '?' to the end
#!/bin/bash
input="$1"
echo "$input"
while read -r var
do
link=$(echo "${var}" |rev |sed 's/^.*?//' |rev)
echo "$link"
done < "$input"
xargs -n 1 curl -O < files.txt
@le0park
le0park / mkdir_with_filename.sh
Created April 16, 2019 07:07
Make directory with exist filename
iterate_dir=$(pwd)
for entry in "${iterate_dir}"/*.jpg
do
fn=$(echo "${entry}" |rev| cut -f 1 -d '/'|rev)
echo "${fn}"
parsed_fn="$(echo ${fn} |cut -f 1 -d '.')"
mkdir "${parsed_fn}"
done
@le0park
le0park / convert_png_to_jpg.sh
Created April 16, 2019 07:06
Convert all .png images to .jpg in subdirectories
base_dir=$(pwd)
list=`find ${base_dir} -type d`
for directory in $list; do
cd $directory
for file in *.png
do
if [ "$file" = "*.png" ]
then
continue