Skip to content

Instantly share code, notes, and snippets.

Greg Sadetsky gregsadetsky

Block or report user

Report or block gregsadetsky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jagregory / gist:710671
Created Nov 22, 2010
How to move to a fork after cloning
View gist:710671
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork
akuzemchak / Side Bar.sublime-menu
Created Aug 13, 2011
Reveal folder in Finder for Sublime Text 2
View Side Bar.sublime-menu
# add this to the main command array...
{ "caption": "Open Containing Folder…", "command": "open_this_folder", "args": {"dirs": []} }
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

endolith /
Created Oct 16, 2012
Export Google Maps starred locations
# -*- coding: utf-8 -*-
Go to Google Bookmarks:
On the bottom left, click "Export bookmarks":
After downloading the html file, run this script on it to generate a KML.
dergachev /
Last active Mar 31, 2020
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF


To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

lonetwin /
Last active Mar 3, 2020
print out ascii tables in python using data in the form: [ ('column 0 title', 'column 1 title' ..), ('row 0, column 0 data', 'row 0, column 1 data' ...) ...]
# I needed to print out ascii tables from data in the form:
# [ ('column 0 title', 'column 1 title' ..),
# ('row 0, column 0 data', 'row 0, column 1 data' ...) ...]
# and surprisingly it got complicated because of variable lengths of the data.
# I googled for 'standard' ways of doing this and I found suggestions like:
# ...which were a bit dated and hard to read or full scale modules like:
gregsadetsky /
Last active Apr 26, 2019
See: -- I was looking for a way to run Selenium tests for a Django app on a staging server hosted on Heroku using a PostgreSQL database. The DjangoTestSuiteRunner creates and destroys the whole database before/after testing, which would not work on Heroku where databases are added via other means (her…
import dj_database_url
'default': dj_database_url.config(env='TEST_DATABASE_URL')
# replace path below to point to HerokuTestSuiteRunner class
fxsjy /
Created Apr 26, 2013
SimpleAuthServer: A SimpleHTTPServer with authentication
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import sys
import base64
key = ""
class AuthHandler(SimpleHTTPRequestHandler):
''' Main class to present webpages and authentication. '''
def do_HEAD(self):
diffused / gist:5517341
Created May 4, 2013
Python peewee orm. How to do a "where in (1,2,3)" style query. It was kind of tricky to find the syntax in the docs/google
View gist:5517341
products = << [161,162,163,164,165]).where(
~(Product.brand_name >> None)
christianberg /
Last active Jan 18, 2020
Shell script to create a Digital Ocean Droplet and install docker
set -e
if [[ -z $DIGOCEAN_ID ]] || [[ -z $DIGOCEAN_KEY ]]; then
if [ -e $SECRETFILE ]; then
You can’t perform that action at this time.