Skip to content

Instantly share code, notes, and snippets.

View toc21c's full-sized avatar
🏠
Working from home

0x323143 toc21c

🏠
Working from home
View GitHub Profile
#!/bin/bash
iscsiadm --mode discovery --type sendtargets --portal $1
#!/bin/bash
echo "iscsiadm -m node --targetname $1 --portal $2 --login"
iscsiadm -m node --targetname $1 --portal $2 --login
@toc21c
toc21c / Regenerate-Thumbnail.sh
Last active January 8, 2016 12:09
Nautilus-Script for recreate thumbnail
#!/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
@toc21c
toc21c / fix-sami.py
Last active January 21, 2016 12:25 — forked from ageldama/fix-sami.py
fix-sami.py python3
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>
#!/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
#!/usr/bin/env bash
find . -name '*.txt' -type f -print0 | wc -l --files0-from=-
#!/usr/bin/env bash
find . -name "*.gz" | xargs -P 5 -I fileName sh -c 'gunzip -c "fileName" > "$(basename -s .gz "fileName")"'
#!/usr/bin/env bash
rsync -a --stats --progress .??* ~/old_dotfiles/
@toc21c
toc21c / rsmv.sh
Created September 7, 2016 16:33
rsync copy & remove folder
#!/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
@toc21c
toc21c / dropbox-better.sh
Created September 11, 2016 13:48
Elementary OS loki
#!/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