Skip to content

Instantly share code, notes, and snippets.

View bryan-lunt's full-sized avatar

Bryan Lunt bryan-lunt

  • Department of Computer Science, UC San Diego
  • Urbana, Illinois
View GitHub Profile
@bryan-lunt
bryan-lunt / LICENSE
Created September 20, 2026 22:50 — forked from justjkk/LICENSE
Parsing JSON with lex and yacc
The MIT License (MIT)
Copyright (c) 2015 J Kishore Kumar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@bryan-lunt
bryan-lunt / nbloader.py
Last active July 26, 2026 18:51
Jupyter / IPython notebook loader for Python >= 3.4 (PEP 451)
#http://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Importing%20Notebooks.html
import io, os, sys, types
from typing import override
import importlib, importlib.abc, importlib.util
from IPython import get_ipython
from nbformat import read
from IPython.core.interactiveshell import InteractiveShell
@bryan-lunt
bryan-lunt / argmax.py
Created July 9, 2026 12:54
Python argmax
def argmax(a_list,key=lambda x:x):
index = 0
maxval = key(a_list[0])
for i,e in enumerate(a_list[1:],1):
v = key(e)
if v > maxval:
index = i
maxval = v
return index
@bryan-lunt
bryan-lunt / dataannotation_dashboard_greasemonkey.js
Created May 22, 2024 17:01
Prevent Lost work on DataAnnotation.tech
// ==UserScript==
// @name Disable Back Button
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Disables the back button for specified URLs
// @author You
// @match https://app.dataannotation.tech/workers/tasks/*
// @grant none
// ==/UserScript==
// Replace "your-target-website-url-here" with the actual URLs you want to target
@bryan-lunt
bryan-lunt / FindGBench.cmake
Last active February 11, 2022 22:12
CMake find_package file to find Google Benchmark. Just sets up targets, does not download. Only tested on Linux.
#Copyright 2022 Bryan J. Lunt <bryan.j.lunt@gmail.com>
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
@bryan-lunt
bryan-lunt / Picard.ipynb
Last active December 8, 2021 09:36
Simple Picard Iteration Example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bryan-lunt
bryan-lunt / parallel_subjob_test.slurm
Last active September 19, 2021 05:42
Example for submitting multiple steps within a SLURM batch file, those steps should execute in parallel if possible.
#!/bin/bash
#SBATCH --time=04:00:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=12
#SBATCH --exclusive
#SBATCH --job-name subjob-sched-test
#SBATCH -p secondary
module load openmpi/4.1.0-gcc-7.2.0-pmi2 gcc cmake
@bryan-lunt
bryan-lunt / lu_fact.py
Created September 17, 2021 19:36
Simple LU factorization examples in Python
import numpy as np
def LU_recursive(A):
"""LU factorization without pivoting. Will fail if any diagonal is 0.
Recursive implementation.
"""
L = np.zeros_like(A,dtype=np.float_)
U = np.eye(*A.shape,dtype=np.float_)
a = A[0,0]
@bryan-lunt
bryan-lunt / sieve.cpp
Created February 7, 2019 21:56
Sieve of Eratosthenese
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <random>
#include <omp.h>
@bryan-lunt
bryan-lunt / MPI_benchmark_example
Created December 25, 2018 15:09 — forked from mdavezac/ MPI_benchmark_example
google/benchmark example with MPI
# for gist naming purposes