Skip to content

Instantly share code, notes, and snippets.

View jayrambhia's full-sized avatar

Jay Rambhia jayrambhia

View GitHub Profile
@jayrambhia
jayrambhia / download-monitor
Created January 14, 2012 14:08
Monitor your downloading data
import pcap, dpkt, socket
import os
import time
pc = pcap.pcap('eth0')
ports = (80, 8080, 443, 888)
def process():
t = time.time()
i = 0
@jayrambhia
jayrambhia / IMDB.py
Last active April 15, 2023 07:57
Fetch movie information from IMDB using Python!
'''
Author : Jay Rambhia
Git : https://github.com/jayrambhia
gist : https://gist.github.com/jayrambhia
'''
import urllib2
from BeautifulSoup import BeautifulSoup
from mechanize import Browser
import re
@jayrambhia
jayrambhia / bookmark-html.py
Created January 27, 2012 19:11
Extract bookmarks (from html file) from the browser
"""
@author: jay
"""
from BeautifulSoup import BeautifulSoup
import gdbm
import pickle
import time
def main():
@jayrambhia
jayrambhia / bookmark-json.py
Created January 28, 2012 06:52
Fetch Bookmark details from temp files of browsers using json
"""
Created on Fri Jan 27 21:48:58 2012
@author: jay
"""
import json
import os
import gdbm
import time
@jayrambhia
jayrambhia / playBanshee.py
Created February 1, 2012 20:48
A python script to play banshee media player(can use only terminal commands).
'''
Author : Jay Rambhia
email : [email protected]
twitter: @jayrambhia
'''
import os
import time
import threading
import sys
from multiprocessing import Process
@jayrambhia
jayrambhia / bookmark.py
Created February 1, 2012 22:49
A python script to back up all the bookmarks(firefox compatible). It returns a dictionary with url as key and (title, tag, add_date, modified_date) tuple as the value. It also stores it in gdbm. Another script is provided to read all the bookmarks.
'''
Author: Jay Rambhia
email : [email protected]
A new script supporting both Mozilla Firefox and Google Chrome bookmarks:
https://github.com/jayrambhia/Bookmark-Manager
'''
import os
import json
import pickle
import gdbm
@jayrambhia
jayrambhia / MakeDirectories.py
Created February 10, 2012 10:44
Create directories (eg. home/user/direc1/direc2/direc3/direc4) even if direc1, direc2, direc3 doesn't exist. It will create all the directories. Just give absolute path.
import os
def makeDir(path):
if os.path.isdir(path):
return
dir1, dir2 = os.path.split(path)
makeDir(dir1)
os.mkdir(path)
return
@jayrambhia
jayrambhia / stickynote.py
Created February 13, 2012 20:38
A simple sticky note application using pygtk!
import pygtk
pygtk.require('2.0')
import gtk
import os
class TextBox:
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_size_request(200,250)
self.window.connect("destroy", self.close_application)
@jayrambhia
jayrambhia / searchfiles.py
Created March 5, 2012 15:22
A script to search files in the given directory. Search file by name, name and type, type, etc
import os
import mimetypes
def main():
target_file = raw_input('Enter the name of the file(Separate with comma): ')
target_type = raw_input('Enter the type of the file(Separate with spaces): ').split()
target_dir = raw_input('Enter directory (Press Enter for current directory)(Separate with comma): ')
flag = 0
if target_file:
target_file = target_file.split(',')
@jayrambhia
jayrambhia / down_xkcd.py
Created March 6, 2012 06:54
A python script to download/update xkcd comic strip
import urllib2
import os
from BeautifulSoup import BeautifulSoup
BASE_URL = "http://xkcd.com"
proxy = {"http":"http://user:pass@proxy:port/",
"https":"https://user:pass@proxy:port/"}
Proxy = urllib2.ProxyHandler(proxy)
opener = urllib2.build_opener(Proxy)