Skip to content

Instantly share code, notes, and snippets.

View narendrans's full-sized avatar

Naren narendrans

View GitHub Profile
#!/bin/sh
# This script mutes system volume during logout or shutdown. To prevent the system from giving the sound during bootup.
touch /Users/naren/Development/shell/mute.sh
echo "#!/bin/sh\nsudo osascript -e \"set Volume 0\"" > /Users/naren/Development/shell/mute.sh
# elevate privileges
sudo chmod +x /Users/naren/Development/shell/mute.sh
@narendrans
narendrans / DatastoreSample.java
Last active August 29, 2015 13:56
Google App Engine Java DataStore example
package info.narendran;
import java.io.IOException;
import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceException;
import javax.servlet.http.HttpServlet;
alert([[]+1/!1][1^1][1>>1]+({}+[])[1<<1^11>>1]+(
[]+!!-[])[1<<1]+[/~/+{}][+!1][-~1<<1]+[([]+/-/[(
!!1+[])[1>>1]+(!!1+[])[1<<1^1]+(!1+[])[1|1<<1]+(
!!1+[])[1^1]])[1+(1^(11+1+1)<<1)],([]+/-/[(!!1+[
])[1>>1]+(!!1+[])[1<<1^1]+(!1+[])[1|1<<1]+(!!1+[
])[1^1]])[1^11<<1],([]+/-/[(!!1+[])[1>>1]+(!!1+[
])[1<<1^1]+(!1+[])[1|1<<1]+(!!1+[])[1^1]])[1^(11
+1+1)<<1]][((([]+/-/[(!!1+[])[1>>1]+(!!1+[])[1<<
1^1]+(!1+[])[1|1<<1]+(!!1+[])[1^1]])[(1<<1<<1<<1
)+1<<1]==({}+[])[1^1])*1)+((([]+/-/[(!!1+[])[1>>
@narendrans
narendrans / run_grader.py
Last active August 29, 2015 13:59
Automatic grader run script for Distributed Systems project
#!/usr/bin/python
# Flow: Run grader -> store the log -> print the mark
# Run in the directory where grader is located
# Usage: run_grader.py <path to grader> <apk path> <number of times to run the grader>
# Author: Naren
# Last Modified: Sat Apr 12 21:27:44 EDT 2014
import os, sys,time
'''
@Author: Naren
@Date: 4/16/2014
This script can be used to delete uploads longer than specified period in years for a wordpress multisite.
Note: Because uploads or wordpress blogs itself can be migrated, the timestamp of an upload wont necessarily reflect the date of creation.
Further the uploads are organized in such a way as below
year
month
<?php
/*
This script provides a demo of minimialistic implementation of typeahead + mysql.
Last modified by Naren on 4/17/2014 12:01 PM ET
Schema:
Column Type
id int
name varchar(50)
@narendrans
narendrans / getFeeds.php
Created April 17, 2014 21:32
Parses the feed and displays the title, author, published date etc in html. All parameters are optional except feed_url
<?php
/**
* This script gets the feeds of the specified rss link.
*
* @author - Naren
* @version - 1.0.0
* @since - 4th April, 2014. 17:23 EST
*
*/
# Router restart script
# This scrit authenticates itself with the router and then restarts the router
# Version 1.0
# Auther - Naren
# Tested on a faulty Belkin router :X
# To execute:
# $ sh restart.sh
# Note: You may want to chmod 777 restart.sh to give it permission
@narendrans
narendrans / hackernews.js
Created November 7, 2014 21:01
Print title, link and score for each HN items
// Print title, link and score for each HN items
// Inject jquery
$('.title>a').each(function(index) {
var titleLink = $(this).text() + "::" + $(this).attr("href");
var score = $(this).parent().parent().next().find($('[id^=score]')).text().replace(/[^\/\d]/g, '');
console.log(titleLink + "::" + score);
});
Movie ID Movie Name Year
0000008 Edison Kinetoscopic Record of a Sneeze 1894
0000091 Le manoir du diable 1896
0000417 Le voyage dans la lune 1902
0000628 The s of Dollie 1908
0000833 The Country Doctor 1909
0001223 Frankenstein 1910
0001740 The Lonedale Operator 1911
0002101 Cleopatra 1912
0002130 Linferno 1911