Skip to content

Instantly share code, notes, and snippets.

View navinpai's full-sized avatar

Navin Pai navinpai

View GitHub Profile

Intro

Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Author: Chris Jacob @_chrisjacob

Tutorial (Gist): https://gist.github.com/833223

The Result

@navinpai
navinpai / get_results.py
Last active December 18, 2015 04:09
Get all CBSE Class 12 Results From http://cbseresults.nic.in/class12/cbse122013.htm
#!/usr/bin/env python
import requests
import os
#Apparently web scraping in now considered *hacking* ... If this is the way India goes, we'll soon be seeing our own 'weev' incident :|
def get_results(i,valid):
params={'regno':i}
print(i)
#Just faking some headers (They're checking the referer... atleast some, albeit weak protection
headers={'Connection':'keep-alive','Accept-Language':'en-US,en;q=0.5','Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8','DNT':'1','User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0','Host': 'cbseresults.nic.in', 'Referer': 'http://cbseresults.nic.in/class12/cbse122013.htm', 'Accept-Encoding': 'gzip, deflate'}
@navinpai
navinpai / download_anime
Created January 17, 2013 10:46
Download complete anime season from AnimeSeed. Written as simple as possible so that a Baka friend can understand it! :) Note: Works only on AnimeSeed, and for video links from auengine.com. For other sites, just modify the get_episode function
from urllib2 import Request, urlopen, URLError, HTTPError
from bs4 import BeautifulSoup
import requests
import re
import urllib
import sys
episodeArray=[]
animeTitle=""
@navinpai
navinpai / rand_json.json
Created October 5, 2012 11:41
JSON of 2 tweets
{"created_at":"Thu Oct 04 08:57:08 +0000 2012","id":253780782756286464,"id_str":"253780782756286464","text":"What is it that strips vocals from audio when a 1\/8\" audio jack is partially unplugged?: http:\/\/t.co\/Rin92QSn","source":"web","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":17186020,"id_str":"17186020","name":"Navin Pai","screen_name":"navinpai","location":"Goa","url":"http:\/\/lifeofnavin.blogspot.com","description":"I'm A Moron Who's Too Lazy To Write A Proper Bio","protected":false,"followers_count":482,"friends_count":170,"listed_count":40,"created_at":"Wed Nov 05 10:21:16 +0000 2008","favourites_count":538,"utc_offset":19800,"time_zone":"Mumbai","geo_enabled":true,"verified":false,"statuses_count":25793,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"000000","profile_background_image_url":"http:\/\/a0.twimg.com\/profi
@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");
@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 / README.md
Last active August 3, 2023 19:48
Konami Nyan Cat
@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 / 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 / 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)
{