Skip to content

Instantly share code, notes, and snippets.

@porthunt
porthunt / read_github_json.py
Created August 6, 2021 19:49
Read json file from a private GitHub repository
import base64
import json
import requests
REPO_URL = "https://api.github.com/repos/<USER>/<REPO>/contents/<PATH>/<TO>/<FILE>.json"
TOKEN = "<YOUR PAT OR OAUTH TOKEN>"
headers = {
"Authorization": f"token {TOKEN}",
"Accept": "application/vnd.github.v4+raw"
@fhk
fhk / lp_solver_wasm.md
Last active May 16, 2024 18:28
Compiling a linked linear programming solver library

Linear Programming Solver running in the browser?

So I wanted to see if I could get a solver running in the browser.

Why you might ask? Well its pretty typical to need to deploy a back end for a webapp or even to have a specific install on your OS.

This makes things clunky if we wanted to say:

  1. Visualize solutions in realtime using some js libs on the client side
  2. Solve models on the client side of a web app
@cocuh
cocuh / bb.py
Created May 9, 2016 04:51
branch and bound algorithm python
import threading as th
from copy import deepcopy
class Node:
def __init__(self, parent=None, state=[]):
self.parent = parent
self.generator_lock = th.Lock()
self.generator = self._child_gen()
self.state = state