Skip to content

Instantly share code, notes, and snippets.

@mikhail
mikhail / README.md
Last active September 25, 2015 19:43
Working with forks, branches, and pull requests

Helper scripts for git

When working with forks & branches for features and pull requests I often find myself needing common actions, like

  1. Create a new branch, and I don't care what it's named
  2. Update the last commit, and keep the commit message
  3. List all the branches I have with some description of what that branch is

Below are the scripts to do just that.

@mikhail
mikhail / README.md
Last active August 29, 2015 14:24
Automatic Github changelog

Doing a proper version release requires documenting all the things you've changed. Frequently CHANGELOG.md is used for these purposes.

Unless you are maintaining that file throughout the changes it can become a hassle. Luckily you can leverage GitHub's issue tracking and PR system to manage that for you. If you use GitHub's milestones like you would versions then you have all the data there for you. However, you're stil left with the collection and formatting of the changes.

The script below automatically grabs that data for you and creates a markdown output. I've been successfully using it for our Kingpin project for several releases. Here's the sample use:

$ ./get_changelog Nextdoor/kingpin 0.2.0
## Version 0.2.0
 * #174: Add actor 'initialization context' support. ([@diranged])
@mikhail
mikhail / README.md
Last active August 29, 2015 14:13
Python: variable scope

Python's scope

Python's scope of variables should be intuitive, but for those that don't find it as such here's a quick example.

In the file below scope.py I create a dummy class Temp() which prints some debug text when its created and destroyed.

$ python scope.py
Initiating quick
Destroying quick
@mikhail
mikhail / README.md
Last active August 29, 2015 14:08
Tornado firing vs yielding

Yielding a list of tasks in Tornado 4.0

Note: This behavior has changed in Tornado 4.1

Executing python yield_all.py will produce results similar to:

$ python run_all.py
one is sleeping
two is sleeping
@mikhail
mikhail / publish.py
Created August 27, 2015 15:44
Git -> WordPress draft publisher
#!/usr/bin/env python
import logging
import md5
import optparse
import os
import re
import subprocess
import sys
from wordpress_xmlrpc import Client, WordPressPost