Skip to content

Instantly share code, notes, and snippets.

Avatar

Mikhail Simin mikhail

View GitHub Profile
@mikhail
mikhail / README.md
Last active Sep 25, 2015
Working with forks, branches, and pull requests
View README.md

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 Jun 13, 2019
Python Generators and Yielding
View README.md

Python Generators and Yielding

In python yield can be used to transfer information in both directions.

yield 'hello'

will generate (vs return) the string "hello", whereas

@mikhail
mikhail / README.md
Last active Aug 29, 2015
Python: variable scope
View README.md

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 Aug 29, 2015
Tornado firing vs yielding
View README.md

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 / README.md
Last active Nov 24, 2015
Bash scripts for backing up mysql to s3 and restoring specific tables from that backup.
View README.md

Backup & Restore MySQL <-> AWS S3

Based on https://gist.github.com/2206527 this script loops through databases and tables and creates individual files that are uploaded to S3.