Skip to content

Instantly share code, notes, and snippets.

@adhipg
adhipg / countries.sql
Created January 12, 2012 11:41
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@adhipg
adhipg / mask-credit-cards.php
Created February 17, 2011 12:02
Mask a Credit Card - keep the first character, last four characters and any non-numeric characters in the middle.
<?php
preg_replace('/(?!^.?)[0-9](?!(.){0,3}$)/', '*', $credit_card_number);
?>
@adhipg
adhipg / how_to.md
Created March 20, 2017 17:13 — forked from rskelley9/how_to.md
Workaround: Connect your Chromecast to a Hotel Wireless Network

About

I recently relocated for new employment. I've been staying in an extended stay hotel for about 3 weeks now. The hotel I'm staying in gives its guests free Wifi access. However, it requires users to accept terms and conditions on a splash page via browser interface before they can use the network. This makes it difficult to use my Chromecast with the network, as it doesn't have a means of accessing tht splash page. While I could call the IT help line, I decided to explore a work-around.

Like many networks, my hotel's network attempts to improve security by using MAC address filtering. Luckily, Mac OS X (10.4 - 10.10) makes it very easy to spoof your network card's MAC address.

Here's how to add a devices like Chromecast, AppleTV, Roku to a wireless network that requires a browser to authenticate and accept terms and conditions.

Before You Start

set -g default-terminal "screen-256color"
set-option -g prefix C-a
unbind C-b
# Ensure that we can send Ctrl-A to other apps
bind C-a send-prefix
set -g status-keys vi
{
"email": "Some email address documentation",
"email": "test@example.com",
"age": "some documentation about age",
"age": 23
}
@adhipg
adhipg / toggl.js
Created February 10, 2013 10:44
Returns a time formatted in H:mm if there is an active timer running in Toggl. I use this to add currently running timers to my `tmux-powerline`
#!/usr/bin/env node
var https = require('https');
var options = {
hostname: 'www.toggl.com',
path: '/api/v6/time_entries.json',
headers: {
'Content-Type': 'application/json'
},
auth: "YOUR_API_TOKEN:api_token"
};
@adhipg
adhipg / gist:3818038
Created October 2, 2012 10:20
Delete all branches that have already been merged into currently checked out branch
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
@adhipg
adhipg / me.sh
Created September 19, 2012 19:07 — forked from papercreatures/me.sh
rewrite locations to vim urls
node <script> 2>&1 | gist.sh
#!/bin/sh
sed -Ee "s#[(]?(/[^:]*/([^ ]*)):([0-9]+):([0-9]*)[)]?#[\2:\3:\4] mvim://open/?url=file://\1\&line=\3\&column=\4#g"