Skip to content

Instantly share code, notes, and snippets.

View narendrans's full-sized avatar

Naren narendrans

View GitHub Profile
<?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)
'''
@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
@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
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 / 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;
#!/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