Skip to content

Instantly share code, notes, and snippets.

@piranha
piranha / github-upload.py
Created July 9, 2012 11:08
Github upload script. Pretty much useless now.
#!/usr/bin/env python
#
# (c) 2012 Alexander Solovyov under terms of ISC License
# to use, install dependencies:
# pip install opster requests
import os, sys, json
from subprocess import check_output
import requests
@piranha
piranha / git-req
Last active November 9, 2019 14:43
Script to create pull requests right from the shell
#!/bin/sh
# git-req -- make a pull request
#
# Assumes branch is pushed to same repo as pull request is made to (origin)
#
# How to obtain GITREQ_TOKEN:
#
# curl -u "$USER:$PASSWORD" -d '{"scopes": ["repo"], "note": "git-req"}' https://api.github.com/authorizations
#
# Usage:
@piranha
piranha / mixin-vs-dec.py
Created May 28, 2011 09:30
Mixin vs class decorator
import logging, timeit
class LoggedSetItemMixin(object):
def __setitem__(self, index, value):
logging.info('Setting %r to %r' % (index, value))
super(LoggedSetItemMixin, self).__setitem__(index,value)
class LoggingDict(LoggedSetItemMixin, dict):
pass