Skip to content

Instantly share code, notes, and snippets.

@bjdixon
bjdixon / last_curl.sh
Created November 2, 2015 17:30
run last curl command
eval $(cat ~/.bash_history | grep curl | head -1 | awk '{print}')
@bjdixon
bjdixon / kill.sh
Created November 24, 2015 16:08
kill processes matching a search pattern
kill $(ps aux | grep SEARCH_PATTERN | awk '{print $2}')
@bjdixon
bjdixon / grep_through_git_diff.sh
Created March 7, 2016 18:37
grep through contents of the list of files returned by git diff
git diff --name-only master | xargs cat | grep "keyword"
@bjdixon
bjdixon / fetch.js
Created May 10, 2016 13:57
Example of using fetch to get json data
fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(err => console.log(err))
@bjdixon
bjdixon / sedReplace.sh
Created May 20, 2016 10:13
Use sed to replace contents in a file
sed -i 's/replacementString/stringToReplace/g' /path/to/filename
@bjdixon
bjdixon / remove_docker_images.sh
Last active August 5, 2016 11:51
Remove all exited docker images
sudo docker ps -a | grep Exited | cut -d ' ' -f 1 | xargs sudo docker rm
@bjdixon
bjdixon / change_git_remote_url.sh
Created October 4, 2016 10:09
Change git remote url
git remote -v
git remote set-url origin new_url_to_repo.git
@bjdixon
bjdixon / rebase.sh
Created October 12, 2016 09:35
rebase from upstream
git pull --rebase upstream master
@bjdixon
bjdixon / filesize.sh
Created February 7, 2017 04:08
Sum file size for files matching a pattern
du -hc ./*.py
@bjdixon
bjdixon / mount_device.sh
Created February 7, 2017 04:10
determine which device was used for a given mount
df -h /home