Skip to content

Instantly share code, notes, and snippets.

View adsahay's full-sized avatar

Aditya Sahay adsahay

View GitHub Profile
@adsahay
adsahay / pre-commit
Last active August 29, 2015 14:01
Cordova/Phonegap - bump version in config.xml as a pre-commit hook
!/bin/sh
# post-commit hook that updates version using semver.
# this one stores versions in the form 1.0.abc123 where the last component is the (short) commit
SEMVER=`which semver`
CONFIG='config.xml'
if [ -s $SEMVER ]; then
# replace last part of the version by commit id.
@adsahay
adsahay / forever.conf
Created May 26, 2014 17:28
Upstart script to run
#!upstart
# upstart script for nodejs+forever
# ref: https://www.exratione.com/2013/02/nodejs-and-forever-as-a-service-simple-upstart-and-init-scripts-for-ubuntu/
description "upstart + nodejs + forever"
start on startup
stop on shutdown
@adsahay
adsahay / current_weather.sh
Created March 13, 2014 06:33
Gets weather information using Yahoo Weather feed and parses it to get current conditions. Based on http://code.google.com/p/sh-weather-rss/ but updated to use WOEID than pin code.
curl --silent "http://weather.yahooapis.com/forecastrss?w=20070458&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'
# Note: Use YQL (eg. http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20text%3D%22New%20Delhi%22&format=json) to find WOEID (the w= param in the url).
# More: http://developer.yahoo.com/weather/