Skip to content

Instantly share code, notes, and snippets.

View stilliard's full-sized avatar
🐝

Andrew Stilliard stilliard

🐝
View GitHub Profile
@nhalstead
nhalstead / dejadup-auto-exclude
Last active August 29, 2022 18:37
This will exclude Node_modules, Vendor (Composer), and Build Folders from the Backup that is run by Deja Dup Backup
#!/bin/bash
# Update Deja Dup Backup Exclude Config for the node_modules folders.
# This will only auto exclude if a package.json file and a .git folder exist.
# This also will update the list for excluding backups of vendor <composer> folders.
if [[ ! -x "$(command -v yq)" ]]; then
echo "'yq' is required. Please install 'yq'. Try 'snap install yq'"
exit 1;
fi
semantic-commit = "!f() { \
if [ \"$3\" != \"\" ]; then \
git commit -S -m \"$1($2): $3\"; \
else \
git commit -S -m \"$1: $2\"; \
fi \
}; f"
chore = semantic-commit chore
@stilliard
stilliard / gdrive-backup-setup.sh
Last active May 8, 2020 22:24
Backup server files with Google Drive
# ref: https://github.com/prasmussen/gdrive
# prerequisite:
# In google drive, setup your folder for storing the backups
# Then grab the code from the url e.g. https://drive.google.com/drive/folders/xxxxx where xxxxx is the code
# This code will be used later in the cron command, keep it secret, keep it safe
# install gdrive sync for backups
wget https://drive.google.com/uc?id=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA -O /usr/local/bin/gdrive
chmod 755 /usr/local/bin/gdrive
@ktkaushik
ktkaushik / redis.sh
Created June 25, 2015 12:09
LUA Eval script to Delete/Expire multiple keys in Redis
EVAL "for i, name in ipairs(redis.call('KEYS', 'author_*')) do redis.call('expire', name, 0); end" 0
@jbonney
jbonney / spotify_keybindings
Created June 9, 2013 13:22
Spotify - Linux key bindings. From XFCE / Ubuntu keyboard shortcuts configuration, assign the control command to their key. http://shkspr.mobi/blog/2011/12/linux-spotify-keybindings/
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrevious
@mayconbordin
mayconbordin / progress_bar.php
Created June 2, 2012 23:55
PHP CLI progress bar in 5 lines of code
<?php
function progress_bar($done, $total, $info="", $width=50) {
$perc = round(($done * 100) / $total);
$bar = round(($width * $perc) / 100);
return sprintf("%s%%[%s>%s]%s\r", $perc, str_repeat("=", $bar), str_repeat(" ", $width-$bar), $info);
}