Skip to content

Instantly share code, notes, and snippets.

@dalhundal
dalhundal / smileStatementFixer.js
Last active August 29, 2015 14:26
Smile.co.uk statements fixer - add balance per row and pending transactions amount.
(function() {
function strToAmount(str) {
var parts = str.trim().match(/^£(\d+\.\d{2})(-)?/);
if (!parts) return 0;
return +(+parts[1] * (parts[2]?-1:1)).toFixed(2);
}
function amountToStr(amount) {
amount = amount.toFixed(2);
if (amount < 0) {
@dalhundal
dalhundal / reboot-dg834g.sh
Created May 4, 2014 16:54
Script to reboot Netgear DG834G router
#!/bin/sh
# Script to reboot netgear DG834G router
# Tried this only on v5, may work on others.
IP=192.168.1.1
USER=admin
PASSWORD=password
curl --user $USER:$PASSWORD $IP/reboot.cgi >/dev/null 2>&1
@dalhundal
dalhundal / namecheap-ddns.sh
Created May 4, 2014 16:48
Shell script to update namecheap.com dynamic dns for a domain with your external IP address
#!/bin/sh
# Shell script to update namecheap.com dynamic dns
# for a domain to your external IP address
HOSTNAME=yoursubdomain
DOMAIN=yourdomainname.com
PASSWORD=y0urp455w0rd
IP=`curl -s echoip.com`