Instantly share code, notes, and snippets.

View readme.md

This is an example of why you need to re-assign promises in a chain to keep the chain in order. They've been given different variables so you can copy & paste both examples into the same terminal.

Note: You'll need to hit <ENTER> again quickly to see the results properly.

View ssudo.sh
# Throw this in your .zshrc (.bashrc may work too)
safe_sudo() {
cmd="${@: 1}"
if [ "" = "$cmd" ]; then
echo "Missing parameters!";
return 1
fi
sudo ${@: 1};
sudo -k;
View Signal Logcat
D/StatusBar.NetworkController( 914): dumpIcon[(gone) stat_sys_5signal_2|null stat_sys_wifi_signal_in_4 (gone) F]
W/RecipientPreferenceDatabase(31082): Muted until: 0
W/PhoneNumberFormatter(31082): Got local CC: CA
W/TextSecureSessionStore(31082): No existing session information found.
W/RecipientPreferenceDatabase(31082): Muted until: 0
View morse-code.json
{
"0": "-----",
"1": ".----",
"2": "..---",
"3": "...--",
"4": "....-",
"5": ".....",
"6": "-....",
"7": "--...",
"8": "---..",
View File_Format_CSVs.md

File Format CSVs - A quick list of common file types to make file parsing easier. Comma and newline delimited for easier human parsing. Still working on adding more data. Data initiailly seeded with data from online-convert.com

Currently copying files from my other gist. WIP.

View Am_I_Root.sh
# /bin/sh
if [[ $EUID -ne 0 ]]; then
echo 'This script must be run as "root".'
echo 'Enter password to elevate privileges:'
SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
SELF=`basename $0`
sudo $SCRIPTPATH'/'$SELF
exit 1
fi
View Audio
"3ga",
"aac",
"aif",
"aiff",
"amr",
"au",
"aup",
"caf",
"flac",
"gsm",
View keybase.md

Keybase proof

I hereby claim:

  • I am james-firth on github.
  • I am jamesfirth (https://keybase.io/jamesfirth) on keybase.
  • I have a public key whose fingerprint is 2598 E5AD E3EB 0C48 0731 96B0 2844 086A 557B 9B3F

To claim this, I am signing this object:

View tv_renamer.py
#############################################################################################
# The MIT License (MIT)
# Copyright (c) 2014 James Firth
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
View hardlink_checker