Skip to content

Instantly share code, notes, and snippets.

View crahan's full-sized avatar

Thomas Bouve crahan

View GitHub Profile
@crahan
crahan / brewup.sh
Last active May 5, 2017 19:21
Update forked OS X Homebrew install (using upstream origin)
function brewup () {
local BREW_PWD=`pwd`
local BREW_PREFIX=`brew --prefix`
local BREW_TAPS=$BREW_PREFIX/Library/taps
cd $BREW_PREFIX
echo "Update to latest git commit."
git checkout master
git fetch upstream
git merge upstream/master
git push origin master
@crahan
crahan / figletpreview.sh
Created August 25, 2014 20:37
Print out a preview of all installed Figlet fonts.
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "I need some text to print."
exit 1
fi
for i in `ls /usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/*.flf`; do
echo -e "==== $(basename $i) ====\n"
figlet -f $i $1
@crahan
crahan / getwanip.sh
Created August 25, 2014 22:21
Get WAN IP
#!/bin/bash
ext_ip=`/usr/bin/curl --silent http://checkip.dyndns.org | awk '{printf $6}' | cut -f 1 -d "<" | tr -d 'n'`
echo $ext_ip
@crahan
crahan / getquote.sh
Created August 25, 2014 22:23
Get a random quote from quotedb.com
#!/bin/sh
# try to pull in a new quote from quotedb.com
newquote=`curl -s http://www.quotedb.com/quote/quote.php?action=random_quote`
# did it succeed?
if [ $? -eq 0 ]; then
# ok, curl was able to pull in a new quote. Parse and cache it
echo $newquote | sed "s/^document.write('\(.*\)<br>.*<a.*>\(.*\)<\/a.*;$/\"\1\" - \2/" > ~/.qotd
fi
@crahan
crahan / checkcloudbleed.sh
Last active May 5, 2017 19:20
Check a list of domains against http://www.doesitusecloudflare.com
#!/bin/bash
# Input: list of domains (without 'http://' or trailing '/')
for i in `cat $1`; do
response=`curl -s http://www.doesitusecloudflare.com/?url=$i | grep "the website uses cloudflare"`
if [ "$response" ]; then
echo "$i: uses Cloudflare!"
#else
# echo "$i: OK"