Skip to content

Instantly share code, notes, and snippets.

Woncheol Lee toc21c

View GitHub Profile
View install-redhat-td-agent2.sh
echo "This script requires superuser access to install rpm packages."
echo "You will be prompted for your password by sudo."
# clear any previous sudo permission
sudo -k
# run inside sudo
sudo sh <<SCRIPT
# add GPG key
@toc21c
toc21c / dropbox-better.sh
Created Sep 11, 2016
Elementary OS loki
View dropbox-better.sh
#!/usr/bin/env bash
# stop it if it's running
dropbox stop &>/dev/null
# start it properly
env XDG_CURRENT_DESKTOP=Unity QT_STYLE_OVERRIDE="" dropbox start -i
@toc21c
toc21c / rsmv.sh
Created Sep 7, 2016
rsync copy & remove folder
View rsmv.sh
#!/usr/bin/env bash
if [ $# -ne 2 ]; then
echo "Usage: ${0##*/} SRC DEST"
exit
fi
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: ${0##*/} SRC DEST"
exit
fi
View backup_dotfiles.sh
#!/usr/bin/env bash
rsync -a --stats --progress .??* ~/old_dotfiles/
View decomp.sh
#!/usr/bin/env bash
find . -name "*.gz" | xargs -P 5 -I fileName sh -c 'gunzip -c "fileName" > "$(basename -s .gz "fileName")"'
View loc_sum.sh
#!/usr/bin/env bash
find . -name '*.txt' -type f -print0 | wc -l --files0-from=-
View detect_external_monitor.sh
#!/bin/bash
# origin:
# https://bbs.archlinux.org/viewtopic.php?id=171655
#inspired of:
# http://unix.stackexchange.com/questions/4489/a-tool-for-automatically-applying-randr-configuration-when-external-display-is-p
# http://ozlabs.org/~jk/docs/mergefb/
# http://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes/181543#181543
# arandr script
@toc21c
toc21c / fix-sami.py
Last active Jan 21, 2016 — forked from ageldama/fix-sami.py
fix-sami.py python3
View fix-sami.py
import sys
import os
import tempfile
import shutil
def fix(src_filename, dst_filename, src_enc, dst_enc):
with open(src_filename, mode='r', encoding=src_enc) as file_in:
with open(dst_filename, mode='w', encoding=dst_enc) as file_out:
file_out.write("""<SAMI>
<HEAD>
@toc21c
toc21c / Regenerate-Thumbnail.sh
Last active Jan 8, 2016
Nautilus-Script for recreate thumbnail
View Regenerate-Thumbnail.sh
#!/bin/bash
BAKIFS=$IFS #internal filed separator
IFS=$'\n'
rm -rf ~/.cache/thumbnails/fail
for FILE in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
touch -m "$FILE"
done
View sed_line_delete.sh
#!/bin/bash
while read line
do
filename=$line
# line 1~23
sed -i '1,23d' $filename
done < $1
You can’t perform that action at this time.