Skip to content

Instantly share code, notes, and snippets.

View sandeep048's full-sized avatar

Sandeep Pathivada sandeep048

  • Spencer Stuart International
  • Dublin
View GitHub Profile
import datetime
start = datetime.datetime.strptime("21-06-2014", "%d-%m-%Y")
end = datetime.datetime.strptime("07-07-2014", "%d-%m-%Y")
date_generator= (start + datetime.timedelta(days=x) for x in xrange((end-start).days))
for date in date_generator:
print date.strftime("%d-%m-%Y")
@sandeep048
sandeep048 / backup_android_user_packages
Created March 12, 2015 11:15
This simple script will backup user installed android applications to the computer. Extremely useful when there is not enough space in the phone. Requires working 'adb shell'.
#!/usr/bin/env python
import subprocess
adb_process = subprocess.Popen(
'adb shell pm list packages -f', shell=True, stdout=subprocess.PIPE)
user_packages = []
while True:
output_line = adb_process.stdout.readline().strip()
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Starter Page</title>
<link href="http://www.flotcharts.org/flot/examples/examples.css" rel="stylesheet" type="text/css">
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="http://www.flotcharts.org/flot/jquery.js"></script>
<script language="javascript" type="text/javascript" src="http://www.flotcharts.org/flot/jquery.flot.js"></script>
@sandeep048
sandeep048 / indian_numerology_calculator.py
Created October 22, 2015 20:09
Indian Numerology Calculator
#! /usr/bin/env python
chmap = {}
for alph, num in [(chr(x+65), x+1) for x in range(26)]:
chmap[alph] = num
def rsum(numlist):
value = sum(int(x) for x in numlist)
# Copyright (c) Sandeep Pathivada.
"""
An example unix socket server that sends heartbeat messages.
"""
from twisted.internet.protocol import Factory
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor, protocol
# Copyright (c) Sandeep Pathivada.
"""
An example unix socket client that recieves heartbeat messages.
"""
from twisted.internet.protocol import Factory
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor, protocol
@sandeep048
sandeep048 / command_archive.sh
Last active March 23, 2016 12:04
Save a copy of useful commands
# Using httpie for transfer.sh.
# Since it is a python plugin might be useful for automation.
# Will not handle extremely large files though.
# The library should use some async mechanism.
http -b PUT https://transfer.sh/fname.ext < fname.ext
# Create a new user account
useradd -d /home/sandeep -m -c "Sandeep Pathivada" sandeep
usermod -G root sandeep
wget https://sift-tool.org/downloads/sift/sift_0.8.0_linux_amd64.tar.gz
sudo tar -xvzf sift_0.8.0_linux_amd64.tar.gz -C /usr/bin/ --strip=1 sift_0.8.0_linux_amd64/sift
rm sift_0.8.0_linux_amd64.tar.gz
#!/usr/bin/python
import SimpleHTTPServer
import SocketServer
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(('', 0), Handler)
print "Serving at 127.0.0.1:%d" % httpd.server_address[1]
httpd.serve_forever()
@sandeep048
sandeep048 / 0_reuse_code.js
Created June 14, 2016 21:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console