Skip to content

Instantly share code, notes, and snippets.

View hongkongkiwi's full-sized avatar
🤓

Andy hongkongkiwi

🤓
View GitHub Profile
URL="http://stackoverflow.com/"
# store the whole response with the status at the and
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL)
# extract the body
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
# extract the status
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
@hongkongkiwi
hongkongkiwi / check_docker_newer_tag.sh
Created April 19, 2018 05:20 — forked from byrnedo/check_docker_newer_tag.sh
Check if newer docker image available.
#!/bin/bash
# ensure running bash
if ! [ -n "$BASH_VERSION" ];then
echo "this is not bash, calling self with bash....";
SCRIPT=$(readlink -f "$0")
/bin/bash $SCRIPT
exit;
fi
# Thanks to this post:
# http://blog.ikato.com/post/15675823000/how-to-install-consolas-font-on-mac-os-x
$ brew install cabextract
$ cd ~/Downloads
$ mkdir consolas
$ cd consolas
$ curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe
$ cabextract PowerPointViewer.exe
$ cabextract ppviewer.cab
@hongkongkiwi
hongkongkiwi / ArrayObjectDemo.coffee
Created September 12, 2016 06:32 — forked from frane/ArrayObjectDemo.coffee
Traversing arrays and objects in CoffeeScript
# Traversing arrays and objects in CoffeeScript
# The array and object we use for testing
arr = [1, 2, 3, 4, 5]
obj = {a: 1, b: 2, c: 3, d: 4, e: 5}
# 'in' has a different meaning in CoffeeScript than in JavaScript
# CS: element in array -> JS: array.indexOf(element) >= 0
console.log '5 in arr: ' + (5 in arr)
@hongkongkiwi
hongkongkiwi / filebot-on-odroid
Last active March 25, 2016 19:32 — forked from Nerten/filebot-on-odroid
Installing filebot on odroid
sudo apt-get -y install openjdk-8-jre-headless mediainfo libchromaprint-tools
#Bug in ca-certificates-java
sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure
sudo mkdir -p /usr/share/filebot/bin
sudo mkdir -p /usr/share/filebot/data
sudo wget http://sourceforge.net/projects/filebot/files/filebot/HEAD/FileBot.jar/download -O /usr/share/filebot/FileBot.jar
sudo bash -c "cat <<EOT > /usr/share/filebot/bin/filebot.sh
#!/bin/sh
java -Dunixfs=false -DuseGVFS=false -DuseExtendedFileAttributes=false -Dfile.encoding=UTF-8 -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dapplication.deployment=ipkg -Dapplication.analytics=true -Duser.home=/usr/share/filebot/data -Dapplication.dir=/usr/share/filebot/data -Djava.io.tmpdir=/usr/share/filebot/data/temp -Djna.library.path=/usr/share/filebot -Djava.library.path=/usr/share/filebot -Dnet.sourceforge.filebot.AcoustID.fpcalc=/usr/bin/fpcalc -jar -Xmx400M /usr/share/filebot/FileBot.jar \"\\\$@\"
EOT"
#!/usr/bin/env bash
sudo apt-get install gcc dpkg-dev cdbs automake autoconf libtool make libssl-dev libsasl2-dev git python-lxml pkg-config
git clone git://github.com/mongodb/mongo-c-driver.git
cd mongo-c-driver
./build/mci.sh --notest --enable-ssl
cd ..
sudo dpkg --install libmongoc-*.deb libbson-*.deb
@hongkongkiwi
hongkongkiwi / stuns
Last active August 29, 2015 14:05 — forked from zziuni/stuns
Public STUN servers
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun.ekiga.net
stun.ideasip.com
stun.iptel.org