Skip to content

Instantly share code, notes, and snippets.

View navinpai's full-sized avatar

Navin Pai navinpai

View GitHub Profile
@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 / 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 / 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'}

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

AngularJS-Learning

A bunch of links to blog posts, articles, videos, etc for learning AngularJS. This list is in its early stages. Feel free to submit a pull request if you have some links/resources to add. Also, I try to verify that the articles below have some real content (i.e. aren't 2 paragraph blog posts with little information) to ensure I'm not listing "fluff" pieces. If you have an idea for a better way to organize these links, please let me know. As I find similar posts in the "General Topics" section, I will break them out into their own categories.

Books

@navinpai
navinpai / getimages.py
Last active December 19, 2015 08:29
Script to get all images from gags247.com. The site has open indexes. Open indexes are NEVER a good thing :|
from bs4 import BeautifulSoup
import requests
def getimages(parentlink):
for link in BeautifulSoup(requests.get(parentlink).text).find_all('a'):
if(link.get('href')[0]!='/'):
if(link.get('href')[-1]=='/'):
getimages(parentlink+link.get('href'))
else:
with open(link.get('href'), 'wb') as f:
for chunk in requests.get(parentlink+link.get('href')).iter_content():
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@navinpai
navinpai / download_sourcetree.py
Last active December 23, 2015 07:29
Downloading pintOS from the vt.edu sourcetree through WayBackMachine
from bs4 import BeautifulSoup
import requests
import os
import re
def downloader(filepage):
getdownload=[]
print "\n\n\n\nCURRENT"+os.getcwd()
for link in BeautifulSoup(requests.get(filepage).text).findAll('a',{'id':"download"}):
@navinpai
navinpai / .conkyrc
Last active December 24, 2015 02:59
Default Conkyrc on #!
#MINIMAL AND HORIZONTAL BAR
#http://crunchbang.org/forums/viewtopic.php?id=59&p=99
# minfo conky -- for the minimalist!
#
# minimalist conky is a horizontal style config.
# configure your desktop margins so conky is always visible.
#
# made from scratch using the conky wiki as reference.
#
@navinpai
navinpai / facebook.py
Created October 17, 2013 10:12
post thanks to everyone on FB who wishes on birthday. Script by Taz.
import requests
import datetime
import time
from random import randrange
TOKEN = "" # add your access token here, with publish_stream permission
def main():
todays_start_unixtimestamp = int(time.mktime((datetime.datetime(datetime.date.today().year, datetime.date.today().month, datetime.date.today().day, 0, 0, 0)).timetuple()))