Skip to content

Instantly share code, notes, and snippets.

@gene1wood
gene1wood / find_admin_teams_of_repos_for_user.py
Created February 6, 2018 22:53
For a given user, identify all repos in a given org for which that user has admin rights, then report the shortest list of team names of teams which are also administrative for those repos.
#!/usr/bin/env python
# This uses pagination functionality not yet present in master of agithub
import agithub.GitHub
import json
from pprint import pprint
def persist_to_file(file_name):
def decorator(original_func):
@gbaman
gbaman / graphql_example.py
Created November 1, 2017 00:18
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
@enpassant
enpassant / vimwiki2html.md
Last active November 15, 2023 01:04
Convert VimWiki to HTML (markdown, mediawiki)

With this wiki2html.sh bash script and pandoc program, you can convert markdown to html.

Usage: In the vim list section of the .vimrcfile, include options:

let g:vimwiki_list = [{'path': ‘your_wiki_place',
  \ 'path_html': ‘wiki_html_location’,
  \ 'syntax': 'markdown',
 \ 'ext': '.md',
@HaiyangXu
HaiyangXu / Server.py
Created May 18, 2014 14:00
A simper python http server can handle mime type properly
# -*- coding: utf-8 -*-
#test on python 3.4 ,python of lower version has different module organization.
import http.server
from http.server import HTTPServer, BaseHTTPRequestHandler
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler