Skip to content

Instantly share code, notes, and snippets.

@shauns
shauns / github_visualise.py
Created April 8, 2015 17:21
Visual GitHub pull requests
from __future__ import unicode_literals
from collections import defaultdict
import random
import requests
from graphviz import Digraph
USERNAME = 'shauns'
PASSWORD = '****'
@clojens
clojens / 01.asciidoc
Last active August 29, 2015 14:10
Windows 8 voice commands
Note
Secret weapon = autohotkey
Start

Open the Start screen

Cancel

Cancel the current action or dialog

Start/stop listening
@leandroh
leandroh / token.py
Created May 14, 2014 14:08
oauth token
import urllib2
url = "http://api.example.com"
req = urllib2.Request(url)
req.add_header("Accept", "application/json")
req.add_header("Content-Type", "application/x-www-form-urlencoded")
req.add_header("Authorization", "Bearer 591768b9-a3ad-443c-a60c-33ccdabb6cce")
res = urllib2.urlopen(req)
@skinp
skinp / basic_auth.py
Created January 11, 2013 02:15
Python basic auth using urllib2
import urllib2, base64
request = urllib2.Request("http://api.url")
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
@Potherca
Potherca / README.md
Last active November 27, 2023 17:44
Create a branch on Github without access to a local git repo using http://hurl.eu/

Ever had the need to create a branch in a repo on Github without wanting (or being able) to access a local repo?

With the aid of [the Github API][1] and any online request app this is a piece of cake!

Just follow these steps:

  1. Open an online request app (like apirequest.io, hurl.it pipedream.com, reqbin.com, or webhook.site)
  2. Find the revision you want to branch from. Either on Github itself or by doing a GET request from Hurl: https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs/heads
  3. Copy the revision hash
  4. Do a POST request from Hurl to https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs with the following as the POST body :
@eteq
eteq / issue2pr.py
Created February 6, 2012 08:23
Python function/script to convert github issues to pull requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Requires python >=2.6
"""
Tool to convert github issues to pull requests by attaching code. Uses the
github v3 API. Defaults assumed for the `astropy <http://www.astropy.org>`_
project.
"""
from __future__ import print_function
@jacobian
jacobian / pullhook.py
Created December 7, 2011 21:53
Github pull request hook
data = {
"active": true,
"config": {"url": "http://postbin.ep.io/33/"},
"name": "trac",
"events": ['pull_request', 'issue_comment', 'issues'],
}
requests.post('https://api.github.com/repos/django/django/hooks',
auth = (USERNAME, PASSWORD),
headers = {'Content-Type':'application/json'},