Skip to content

Instantly share code, notes, and snippets.

View naveen's full-sized avatar

naveen naveen

View GitHub Profile
@naveen
naveen / UIWebView-intercept.m
Last active December 16, 2015 15:19
intercept custom JS handlers and inject custom HTTP headers in a UIWebView
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
BOOL headersArePresent = [[request allHTTPHeaderFields] objectForKey:@"X-Custom-Timezone"] != nil;
if (!headersArePresent) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{
NSURL *url = [request URL];
if ([[url scheme] isEqualToString:@"customjs"]) {
// parse the rest of the URL object and execute functions
@naveen
naveen / afconvert-wav-caf.sh
Created May 23, 2013 16:41
convert a wav into a caf suitable for ios push.
afconvert ~/Desktop/reminder.wav ~/Desktop/reminder.caf -d ima4 -f caff -v
@naveen
naveen / linode-debian-initial
Created June 10, 2013 23:47
getting up and going on linode with debian 6
ssh root@_
echo "kitsune" > /etc/hostname
hostname -F /etc/hostname
to /etc/hosts:
12.34.56.78 plato.example.com plato
2600:3c01::a123:b456:c789:d012 plato.example.com plato
dpkg-reconfigure tzdata
@naveen
naveen / an-nginx-https-config
Last active December 18, 2015 09:18
nginx http+https (www.* and api.*)
Generate Certificates
To generate private (dummy) certificates you can perform the following list of openssl commands.
First change directory to where you want to create the certificate and private key, for example:
$ cd /usr/local/nginx/conf
Now create the server private key:
$ openssl genrsa -out server.key 2048
You can also create a private key with a passphrase, but you will need to enter it every time you start nginx:
@naveen
naveen / genstrings-r.sh
Created December 3, 2013 20:55
recurse *.m for strings
find . -name \*.m | xargs genstrings
@naveen
naveen / group-genstrings.sh
Created December 4, 2013 16:04
To genstrings, grouped by filename (Using https://github.com/samwize/localized)
python -c "import urllib2; exec urllib2.urlopen('https://raw.github.com/samwize/localized/master/genstrings.py').read()" > Localizable.strings
@naveen
naveen / everyplacemap.html
Created February 8, 2014 22:47
every place i've been map.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>every place i've been.</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<script src='http://api.tiles.mapbox.com/mapbox.js/v1.5.2/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.5.2/mapbox.css' rel='stylesheet' />
@naveen
naveen / keybase.md
Created March 24, 2014 20:53
keybase.md

Keybase proof

I hereby claim:

  • I am naveen on github.
  • I am naveen (https://keybase.io/naveen) on keybase.
  • I have a public key whose fingerprint is DEB2 4190 A5A4 5E4C 61B0 9C7E DCEB 3B72 958C DB81

To claim this, I am signing this object:

@naveen
naveen / naveen-citibike-trips-20140815
Created September 18, 2014 19:31
naveen citibike trips 20140815
start_station,start_station_lat,start_station_lon,start_time,end_station,end_station_lat,end_station_lon,end_time,actual_duration,estimated_duration,estimated_distance
Great Jones St,40.72743423,-73.99379025,6/30/14 10:30:27 AM,Cleveland Pl & Spring St,40.7218158,-73.99720307,6/30/14 10:34:23 AM,236.0,417,1562
Cleveland Pl & Spring St,40.7218158,-73.99720307,6/30/14 8:55:28 AM,Great Jones St,40.72743423,-73.99379025,6/30/14 8:58:33 AM,185.0,199,704
Great Jones St,40.72743423,-73.99379025,6/26/14 11:36:57 PM,Cleveland Pl & Spring St,40.7218158,-73.99720307,6/26/14 11:41:38 PM,281.0,417,1562
Great Jones St,40.72743423,-73.99379025,6/26/14 6:10:45 PM,Cleveland Pl & Spring St,40.7218158,-73.99720307,6/26/14 6:16:44 PM,359.0,417,1562
Cleveland Pl & Spring St,40.7218158,-73.99720307,6/26/14 5:01:41 PM,Great Jones St,40.72743423,-73.99379025,6/26/14 5:06:05 PM,264.0,199,704
Broadway & E 14 St,40.73454567,-73.99074142,6/24/14 3:14:29 PM,Cleveland Pl & Spring St,40.7218158,-73.99720307,6/24/14 3:24:47 PM,618.0,432,168
@naveen
naveen / scrubs
Last active December 2, 2021 05:50
Scrubs: Your monthly notice to go through and disconnect unused applications across various services.
Your monthly notice to go through and disconnect unused applications across various services.
Twitter: https://twitter.com/settings/applications
Dropbox: https://www.dropbox.com/account/connected_apps
Facebook: https://www.facebook.com/settings?tab=applications
Google Apps: https://security.google.com/settings/security/permissions?pli=1
Google Ads: http://www.google.com/ads/preferences
Google Account: https://security.google.com/settings/security/secureaccount
Foursquare: https://foursquare.com/settings/connections
Instagram: https://instagram.com/accounts/manage_access