Skip to content

Instantly share code, notes, and snippets.

import sys
from gi.repository import Gtk, Gdk, WebKit
class BrowserTab(Gtk.VBox):
def __init__(self, *args, **kwargs):
super(BrowserTab, self).__init__(*args, **kwargs)
go_button = Gtk.Button("go to...")
go_button.connect("clicked", self._load_url)
self.url_bar = Gtk.Entry()
@prasoon2211
prasoon2211 / pytrace
Last active August 29, 2015 13:56
pytrace
import sys, linecache
def tracefunc(frame, event, arg, indent=[0]):
if event == "call" or event == "return":
lineno = frame.f_lineno
filename = frame.f_globals["__file__"]
if filename == "<stdin>":
filename = "traceit.py"
if (filename.endswith(".pyc") or
filename.endswith(".pyo")):
filename = filename[:-1]
@prasoon2211
prasoon2211 / .xmodmap
Created August 1, 2013 16:50
Switch Ctrl and Caps
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
@prasoon2211
prasoon2211 / .vimrc
Created August 1, 2013 16:49
Vi config
set incsearch " BUT do highlight as you type you search phrase
set laststatus=2 " always show the status line
set lazyredraw " do not redraw while running macros
set linespace=0 " don't insert any extra pixel lines betweens rows
set list " we do what to show tabs, to ensure we get them out of my files
set listchars=tab:>-,trail:. " show tabs and trailing
set matchtime=5 " how many tenths of a second to blink matching brackets for
set nohlsearch " do not highlight searched for phrases
set nostartofline " leave my cursor where it was
set novisualbell " don't blink
@prasoon2211
prasoon2211 / .emacs
Last active December 20, 2015 12:39
Emacs config
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
(mouse-wheel-mode t)
;; ========== Place Backup Files in Specific Directory ==========
;; Enable backup files.
(setq make-backup-files t)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
(mouse-wheel-mode t)
;; ========== Place Backup Files in Specific Directory ==========
;; Enable backup files.
(setq make-backup-files t)
@prasoon2211
prasoon2211 / gist:5313156
Created April 4, 2013 19:00
Sort facebook friend list, closest friend first.
An algorithm to sort a person's friend list, closest friends first.
Problem: Given the publicly available information on facebook, how to
sort the friend list in an order that list closest/most relevant friends
first?
We are assuming the following things are available (in no particular order):
1. Location information: All the locations
2. Schools/University attended
3. Birthday