Skip to content

Instantly share code, notes, and snippets.

import requests
def repositories_json(page):
return requests.get(f"https://api.github.com/orgs/resgroup/repos?type=private&page={page}&per_page=100",
headers={'Authorization': 'token 32511df370378bb51e1c0ae19ccafc7e3bc74dd3'}).json()
def format_repository(repository):
try:
return f"{repository['name']},\"{repository['description']}\",{repository['created_at']},{repository['updated_at']},{repository['pushed_at']},{repository['size']},{repository['language']},{repository['archived']}"
except:
@ceddlyburge
ceddlyburge / TidyUp.md
Last active April 11, 2017 16:58
TidyUp class that allows you to use a `using` statement, to ensure that something is done when it goes out of scope.

TidyUp is a class that allows you to use a using statement, to ensure that something is done when it goes out of scope. It makes it obvious what the "end" type action is for a "start" type action, puts both actions next to each other and ensures that the end action gets called.

This code has a minor quality issue, in that the indentLevel++ statement could be a long way away from the indentLevel-- statement, and one could get updated without the other.

public class ObjectWriter
{
	int indentLevel;

	public void WriteRootObject(SomeClass someClass)
@ceddlyburge
ceddlyburge / print_organisation_commits_on_github_since_date.py
Created February 6, 2017 16:55
Print organisation commits on github since date. This queries the github api using a personal access token. The token in this gist has been deleted.
import requests
def print_commit(commit):
if "sha" in commit:
print("{},{},{},\"{}\"".format(commit["sha"], commit["commit"]["author"]["date"], commit["commit"]["author"]["name"], commit["commit"]["message"]).replace("\r", "").replace("\n", ""))
else:
print(commit)
def print_commits(repository_name):
print(repository_name)