Skip to content

Instantly share code, notes, and snippets.

View mattmc3's full-sized avatar
🐍
Python!

mattmc3 mattmc3

🐍
Python!
View GitHub Profile
@mattmc3
mattmc3 / strip_header_line.bash
Created April 6, 2017 01:10
Bash - remove first line of file
tail -n +2 $FILE > $FILE.new
@mattmc3
mattmc3 / shebang.bash
Created April 6, 2017 01:11
Bash - shebang
#!/usr/bin/env bash
@mattmc3
mattmc3 / shebang.py
Created April 6, 2017 01:11
Python - shebang
#!/usr/bin/env python
@mattmc3
mattmc3 / shebang.awk
Created April 6, 2017 01:12
Awk - shebang
#!/usr/bin/env awk -f
@mattmc3
mattmc3 / add_gitkeep_files.bash
Created April 6, 2017 01:14
Git - add .gitkeep to empty dirs
find . -type d ! -path "*.git*" -empty -exec touch '{}'/.gitkeep \;
@mattmc3
mattmc3 / find_and_del.bash
Created April 6, 2017 01:16
Bash - find and delete files
# use .DS_Store as notorious example
find . -type f -name '.DS_Store' -delete
@mattmc3
mattmc3 / find_and_del.bash
Last active April 6, 2017 01:21
Bash - find, print, and delete files
# use infamous .DS_Store as example. Use `-type d` for dirs
find . -type f -name '.DS_Store' -print -exec rm -rf {} \;
@mattmc3
mattmc3 / find_and_rename.bash
Created April 6, 2017 01:23
Bash - rename directories
find . -depth -name "{{old}}" -type d -execdir bash -c 'mv {} {{new}}' \;
@mattmc3
mattmc3 / make_venv.bash
Created April 6, 2017 01:27
Python - make virtual environment
python3 -m venv ~/.virtualenvs/my-venv
@mattmc3
mattmc3 / add_another_remote.bash
Last active December 20, 2017 18:06
Git add multiple remotes
git remote -v
git config --get remote.origin.url
git remote set-url origin --push --add git@github.com:mattmc3/sublime-text-settings.git
git remote set-url origin --push --add git@bitbucket.org:mattmc3/sublime-text-settings.git
git remote -v
git push