Skip to content

Instantly share code, notes, and snippets.

View xbuzz's full-sized avatar

Chris Williams xbuzz

View GitHub Profile
@xbuzz
xbuzz / html.json
Last active February 6, 2018 02:42
VSCode Image Placeholder Snippet
{
"Image Placeholder": {
"prefix": "ph",
"body": [
"<img src=\"https://picsum.photos/${1:300}/${2:300}\">"
],
"description": "Placeholder image from picum.photos"
}
}
@xbuzz
xbuzz / pip-sync.sh
Created September 19, 2017 13:18
Ensure all Python packages in requirements.txt are installed. Uninstall any packages not listed in requirements.txt
#!/bin/bash
# pip-sync - Uninstall any packages currently installed within the virtualenv
# not currently listed in `requirements.txt`.
#
# After cleaning up dependencies we will install any packages that
# may be missing.
# only run in virtualenv
if [[ "$VIRTUAL_ENV" == "" ]]; then
@xbuzz
xbuzz / filesize_by_extension.sh
Created March 25, 2017 17:09
Find the total file size of a specific filetype in a directory
# Find the filesize of all .jpg files in the current directory and subdirectories
find . -iname '*.jpg' -exec du -ch {} + | grep total$
@xbuzz
xbuzz / guetzli-jpg-compress.sh
Last active March 21, 2017 17:36
Compress all JPG (.jpg) files in a directory using Google's Guetzli
# Snippets for compressing JPG images in a directory.
# inplace (overwrites original)
find . -iname "*.jpg" -print0 | xargs -0 -n1 -t -I {} guetzli {} {}
# inline + save original (*.jpg -> *.o.jpg)
find . -iname "*.jpg" -print0 | tee compress_tee | xargs -0 -n1 -I {} cp {} {}.o.jpg
cat compress_tee | xargs -0 -n1 -t -I {} guetzli {} {}
rm compress_tee
@xbuzz
xbuzz / vagrant_bash_aliases.sh
Created April 30, 2015 14:52
Vagrant bash aliases
# vagrant
alias v='vagrant version && vagrant global-status'
alias vst='vagrant status'
alias vup='vagrant up'
alias vdo='vagrant halt'
alias vssh='vagrant ssh'
alias vkill='vagrant destroy'
@xbuzz
xbuzz / README.md
Created October 12, 2013 16:52 — forked from nikcub/README.md
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.