View bash_completion.diff
32,38c32,38 | |
< #if ! shopt -oq posix; then | |
< # if [ -f /usr/share/bash-completion/bash_completion ]; then | |
< # . /usr/share/bash-completion/bash_completion | |
< # elif [ -f /etc/bash_completion ]; then | |
< # . /etc/bash_completion | |
< # fi | |
< #fi | |
--- | |
> if ! shopt -oq posix; then |
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View WebFileServer.py
#!/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() |
View Install sift tool in ubuntu 64 bit.
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 |
View command_archive.sh
# 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 |
View twistd_unix_socket_client.py
# 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 |
View twistd_unix_socket_server.py
# 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 |
View indian_numerology_calculator.py
#! /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) |
View Flot_Starter
<!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> |
View backup_android_user_packages
#!/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() |
NewerOlder