Skip to content

Instantly share code, notes, and snippets.

View raghavkaul's full-sized avatar

Raghav Kaul raghavkaul

  • United States
View GitHub Profile
@raghavkaul
raghavkaul / installations.py
Last active February 6, 2023 22:57
List installations of a GitHub App
#!/usr/bin/python3
import functools
import pathlib
import time
import jwt
import requests
@raghavkaul
raghavkaul / patch.py
Last active November 12, 2020 00:32
Parse git unified diff files in python3
import re
class Patch:
""" Parses and encapsulates a git unified diff/patch file. """
# See: https://stackoverflow.com/questions/987372/what-is-the-format-of-a-patch-file
# Chunk headers look like: @@ -4,9 +4,12 @@. The following regex parses them
ptn = (
r"@@ -(?P<old_start>\d+)," # Where the chunk begins in the old file
@raghavkaul
raghavkaul / ore.py
Created May 31, 2020 19:14
cytpes support for Stanford's order-revealing encryption library
import ctypes
orelib = ctypes.cdll.LoadLibrary("./ore.so")
class PrintableCtypesStructure(ctypes.Structure):
def __str__(self):
return "{}: {{{}}}".format(
self.__class__.__name__,
", ".join(