Skip to content

Instantly share code, notes, and snippets.

View navinpai's full-sized avatar

Navin Pai navinpai

View GitHub Profile
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// KuNG FU JS v.1 20yrsplus.info
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//alert('Photo Uploaded! Please wait 1-2 minutes without leaving this page until we process your picture!');
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
@navinpai
navinpai / html_to_text.cpp
Created May 15, 2011 02:53
HTML Number to Text
/***********************************************************************************
Basically takes a file with HTML numbers as input and outputs the converted text to another file.
HTML Numbers is:
A A
B A
etc.
Mainly did this to decrypt(?) lyrics from lyrics sites like SongLyrics.com which allow only viewing but not copying of lyrics (The whole GraceNote license thing) eg. http://www.songlyrics.com/flobots/we-are-winning-lyrics/ ... source code of the page shows the lyrics in HTML numbers.
Compiled with Codeblocks v. 8.02
@navinpai
navinpai / physicist_party
Created May 20, 2011 19:39
Physicist's Party
One day, all of the world's famous physicists decided to get together for a party (ok, there were some non-physicists too who crashed the party). Fortunately, the doorman was a grad student, and able to observe some of the guests...
Everyone gravitated toward Newton, but he just kept moving around at a constant velocity and showed no reaction.
Einstein thought it was a relatively good time.
Coulomb got a real charge out of the whole thing.
Cauchy, being the mathematician, still managed to integrate well with everyone.
Thompson enjoyed the plum pudding.
Pauli came late, but was mostly excluded from things, so he split.
Pascal was under too much pressure to enjoy himself.
Ohm spent most of the time resisting Ampere's opinions on current events.
@navinpai
navinpai / magic
Created May 20, 2011 19:42
Magic data for file(1) command
# Magic
# Magic data for file(1) command.
# Machine-generated from src/cmd/file/magdir/*; edit there only!
# Format is described in magic(files), where:
# files is 5 on V7 and BSD, 4 on SV, and ?? in the SVID.
#------------------------------------------------------------------------------
# Localstuff: file(1) magic for locally observed files
#
# $File: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $
@navinpai
navinpai / getresults.php
Created August 14, 2011 22:23
PHP Curl script to get results of all students from Goa University site
<?php
//Stupid Univ. didn't release results, instead each student had to enter seat number to get his result!
// Wrote this script to automate the process and get the results of students from Seat No. 1-999 (Think that's the
// complete range of seat numbers)
// You end up with a seatno.html files for all seat nos in the range 1-999 ... Result of seat no. 'a' is 'a.html'
// Ran this on Ubuntu running LAMPP and it worked as expected! Nothing platform specific, so should work for you too!
// Edit if you need to find results of another semester (or if u are disgusted by the shitty code I've written and
//want to improve the code!)
$id = '4'; //Was a hidden field... Dunno what it is for
@navinpai
navinpai / terminal_tricks
Created August 14, 2011 22:44
Terminal Tricks
//Search all files in current folder for a text string and return filenames
find . -type f -exec grep -l "text to look for" {} \;
//Turn off Monitor
xset dpms force off
@navinpai
navinpai / lulzhunter.php
Created August 15, 2011 11:45
Lulzhunter - Find Lulzsec's IP from CloudFlare config (by th3j35t3r)
<?php
// lulzhunter.php - by th3j35t3r
// Linux only really.
// This is a PHP Command line script.
// So you are gonna need PHP5 and PHP5-CLI
// If ya don't got that you can get em using this (on Ubuntu):
// 'sudo apt-get install php5 php5-cli'
// Then from your shell just execute 'php lulzhunter.php'
@navinpai
navinpai / fixplymouth.sh
Created August 15, 2011 11:50
Fix Plymouth(by D0rkye)
#!/bin/bash
# ----------------------------------
# Author: D0rkye
# Homepage: http://d0rkye.zsenialis.com/
# Most code probably by kyleabaker: http://kyleabaker.com/2010/07/11/how-to-fix-your-ubuntu-boot-screen/
# ----------------------------------
sudo apt-get install v86d hwinfo -y
sudo hwinfo --framebuffer
echo "---------------------------------------------------------------"
echo "Please enter the best resolution from the list above"
@navinpai
navinpai / convert.bat
Created November 23, 2011 16:14
Convert M4A to MP3 With VLC
@ECHO OFF
REM Use this to convert m4a's to mp3's using VLC (http://www.videolan.org/vlc/).... Had to find this to convert songs
REM downloaded with https://github.com/navinpai/8Tracks-Downloader :P :)
:START
FOR /R %%G IN (*.m4a) DO (CALL :SUB_VLC "%%G")
FOR /R %%G IN (*.m4a.mp*) DO (CALL :SUB_RENAME "%%G")
FOR /R %%G IN (*.m4a) DO (del "%%G")
sleep 1000
GOTO :START
GOTO :eof
@navinpai
navinpai / config.ru
Created December 26, 2011 19:20
Sinatra :: Get Dropbox public folder contents as JSON file
#Basically the heart of the Publicbox (https://github.com/hmans/publicbox) code
# See whole file at: https://github.com/hmans/publicbox/blob/master/config.ru
get '/*' do |path|
doc = Nokogiri::HTML(open("https://www.dropbox.com/#{path}").read)
files = []
doc.css('#list-view div.filerow').each do |row|
files << {
filename: row.css('div.filename a').first.content.strip,
size: row.css('div.filesize span.hidden').first.content.to_i,
modified: row.css('div.modified span.hidden').first.content.to_i,