This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer