Skip to content

Instantly share code, notes, and snippets.

View navinpai's full-sized avatar

Navin Pai navinpai

View GitHub Profile
@navinpai
navinpai / sopa_emergency.txt
Created January 3, 2012 13:44
SOPA Emergency IP list
SOPA Emergency IP list:
So if these ass-fucks in DC decide to ruin the internet, here’s how to access your favorite sites in the event of a DNS takedown
tumblr.com 174.121.194.34
wikipedia.org 208.80.152.201
# News
bbc.co.uk 212.58.241.131
aljazeera.com 198.78.201.252
@navinpai
navinpai / forms_flask.py
Created January 3, 2012 19:03
Form Processing with Flask
#From http://flask.pocoo.org/docs/quickstart/
from flask import request
@app.route('/login', methods=['POST', 'GET'])
def login():
error = None
if request.method == 'POST':
if valid_login(request.form['username'],
request.form['password']):
@navinpai
navinpai / resizer.js
Created February 1, 2012 15:55 — forked from codepo8/resizer.js
Resize image to thumbnail size
function resize( imagewidth, imageheight, thumbwidth, thumbheight ) {
var w = 0, h = 0, x = 0, y = 0,
widthratio = imagewidth / thumbwidth,
heightratio = imageheight / thumbheight,
maxratio = Math.max( widthratio, heightratio );
if ( maxratio > 1 ) {
w = imagewidth / maxratio;
h = imageheight / maxratio;
} else {
w = imagewidth;
@navinpai
navinpai / wrttn.rb
Created March 9, 2012 08:28
Create notes on wrttn (http://wrttn.me)
#For some reasons, Fonts aren't getting rendered in Firefox. Not sure why!
#Using gectechnix.in as a temp filestore. Will prolly be deleting the fonts from the server soon
#If it works right, this is how your note looks: Default: http://wrttn.me/bf1081/ ( http://www.diigo.com/item/image/x9o0/vm2u?size=o ) Black: http://wrttn.me/537a88/ ( http://www.diigo.com/item/image/x9o0/q02j?size=o )
require 'net/http' #For making the actual POST
require 'json' #For parsing the POST data
require 'launchy' #For opening generated link in default browser
$/ = "~~"
uri=URI('http://wrttn.me/api/v1/notes.json')
print "Create Notes on http://wrttn.me via command line\n"
@navinpai
navinpai / remove_9gag_watermark.php
Created May 20, 2012 17:11
Remove watermark/link from 9GAG Images
<?php
// Got bored/bugged of seeing the watermarks/Link at the bottom of 9GAG images. So wrote this script to remove them
// Eg. http://d24w6bsrhbeh9d.cloudfront.net/photo/4216213_700b_v1.jpg
// Very very basic PHP, but gets stuff done!
// Coded while listening to: http://8tracks.com/jkurtis/we-ll-run-wild :D
// USAGE: Put all pics in a 'pics' folder and create an empty 'crop' folder. Run Script. Enjoy. :D
$count=0;
echo "<h6>STARTED</h6>";
foreach(glob('pics/{*.jpg,*.jpeg,*.png}', GLOB_BRACE) as $image)
{
@navinpai
navinpai / latency.txt
Created May 31, 2012 12:51 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@navinpai
navinpai / download_bandcamp.php
Created June 2, 2012 08:35
PHP-Curl script to download music from album pages on Bandcamp
<?php
/* I'm absolutely in love with BandCamp as a platform for musicians, both in terms of concept and UI/UX and the artists on on it.
The music is awesome, so wrote this small script to scrape the music off the album pages on BandCamp to your computer. Yes, they're 128K MP3s, not the higher def that the site offers for purchase, but beggars can't be choosers right? :P
Simple script, basic CURL-ing :)... Downloads songs to the songs folder. So folder structure should be:
|-download_bandcamp.php
|--songs
Coded while listening to 'As Of Yet Unnamed' by Mayhem, who's a personal inspiration (He's Renard Queenston AKA Renard, Adraen, Azrael, Furries in a Blender (formerly named Emoticon), Jackal Queenston, Kitsune, Klippa, Mayhem and NegaRen), for the numerous avatars of music he plays, each so awesome! :)
Check him out on: http://www.lapfoxtrax.com/ :)
@navinpai
navinpai / README.md
Last active August 3, 2023 19:48
Konami Nyan Cat
@navinpai
navinpai / README
Created June 9, 2012 19:18
Simple CSS Blinking Cursor
Simple blinking cursor... code from http://xip.io/ ... Ofcourse I don't own the code! Just keeping it here as a reference of the CSS3 code used.
@navinpai
navinpai / unblur_quora.user.js
Created August 15, 2012 09:55 — forked from swanson/unblur_quora.user.js
Chrome user script to unblur Quora answers without signing up
// ==UserScript==
// @match http://*.quora.com/*
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//code.jquery.com/jquery-latest.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");