Instantly share code, notes, and snippets.

View config.yaml
directory: /mnt/chawley/Music
library: /home/chawley/musiclibrary.blb
import:
# write metadata to music files
write: yes
# move imported files from source to the music directory
move: yes
copy: no
View snow.sh
alias snow="clear;while :;do echo \$LINES \$COLUMNS \$((\$RANDOM%\$COLUMNS));sleep 0.1;done|gawk '{a[\$3]=0;for(x in a) {o=a[x];a[x]=a[x]+1;printf \"\033[%s;%sH \",o,x;printf \"\033[%s;%sH*\033[0;0H\",a[x],x;}}'"
View calibre-stylesheets.md

Clean

html {
	height: 100%;
	width: 100%;
	padding: 0;
	margin: 0;
}

body {
View config
[global_config]
scroll_tabbar = True
tab_position = bottom
title_transmit_bg_color = "#b21f0b"
title_use_system_font = False
[keybindings]
[layouts]
[[default]]
[[[child1]]]
parent = window0
View keybase.md

Keybase proof

I hereby claim:

  • I am crh0831 on github.
  • I am chawley (https://keybase.io/chawley) on keybase.
  • I have a public key ASBtlfHbu5bxrIM2dwud_vA1z8xVqlSlJlO1Ia8_eUUreAo

To claim this, I am signing this object:

View spaces_in_a_loop.md
o=$IFS; IFS=$(echo -en "\n\b"); for i in $(ls); do echo "$i"; done; IFS=$o
View Change-UIDS-and-GIDS.md

Here's the commands to run as root to change the UID and GID for a user. Simply change the variables in angled brackets to match your settings:

usermod -u <NEWUID> <LOGIN>    
groupmod -g <NEWGID> <GROUP>
find / -user <OLDUID> -exec chown -h <NEWUID> {} \;
find / -group <OLDGID> -exec chgrp -h <NEWGID> {} \;
usermod -g <NEWGID> <LOGIN>

usermod and groupmod simply change the UID and GID for their respective named counterpart usermod also changes the UID for the files in the homedir but naturally we can't assume the only place files have been created is in the user's homedir.

View git-mass-rename.md

For each .erb file, git mv it to itself with the extension .erb replaced by .haml.

for i in $(find . -iname "*.erb"); do git mv "$i" "$(echo $i | rev | cut -d '.' -f 2- | rev).haml"; done

from: StackOverflow

View git-status-all-repos.md

Find all git directories and run a git status on each repo found

for i in $(find . -type d -name ".git"); do echo $i; git --git-dir=$i --work-tree=$(dirname $i) status; echo "";done
View shebang.md

Summary

Not every system has binaries in the same location!

From Ycombinator

clarry 708 days ago

Are there any situations where you wouldn't be able to find bash in /bin/bash?