Instantly share code, notes, and snippets.

Charles Hawley crh0831

View GitHub Profile
View config.yaml
directory: /mnt/chawley/Music
library: /home/chawley/musiclibrary.blb
# write metadata to music files
write: yes
# move imported files from source to the music directory
move: yes
copy: no
crh0831 /
Created Dec 7, 2017
Snow in your terminal (alias)
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;}}'"
crh0831 /
Created Oct 31, 2017
Calibre Reader Sylesheets


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

body {
crh0831 / config
Created Oct 23, 2017
My terminator config (save to ~/.config/terminator/config )
View config
scroll_tabbar = True
tab_position = bottom
title_transmit_bg_color = "#b21f0b"
title_use_system_font = False
parent = window0

Keybase proof

I hereby claim:

  • I am crh0831 on github.
  • I am chawley ( on keybase.
  • I have a public key ASBtlfHbu5bxrIM2dwud_vA1z8xVqlSlJlO1Ia8_eUUreAo

To claim this, I am signing this object:

crh0831 /
Created Oct 15, 2017
Handle spaces in a `for..loop`
o=$IFS; IFS=$(echo -en "\n\b"); for i in $(ls); do echo "$i"; done; IFS=$o

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.


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

crh0831 /
Created Oct 15, 2017
Get status of all git repos

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
crh0831 /
Last active Oct 11, 2017
The case for `/usr/bin/env bash`


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?