Skip to content

Instantly share code, notes, and snippets.

View sambrightman's full-sized avatar

Sam Brightman sambrightman

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sambrightman
sambrightman / unparse_literal_includes.py
Last active October 4, 2020 21:47
Get equivalent text for ReStructured Text literal includes when they aren't supported
import docutils.nodes
def unparse_literal_includes(doc, indent=''):
texts = {}
for node in doc.traverse(docutils.nodes.literal_block):
if 'source' in node.attributes:
classes = iter(node.attributes['classes'])
names = iter(node.attributes['names'])
primary_class = next(classes, None)
if primary_class == 'code':
@sambrightman
sambrightman / squareroots.py
Created May 2, 2020 09:26
Square root implementations
import random
import math
import numpy
import ctypes
import struct
def test_math():
x = random.randint(0, 1000)
root = math.sqrt(x)
@sambrightman
sambrightman / # apr-util - 2019-05-10_09-05-59.txt
Created May 10, 2019 13:06
apr-util on "Red Hat Enterprise Linux Server release 6.10 (Santiago)" - Homebrew build logs
Homebrew build logs for apr-util on "Red Hat Enterprise Linux Server release 6.10 (Santiago)"
Build date: 2019-05-10 09:05:59
@sambrightman
sambrightman / # apr-util - 2019-05-10_09-05-23.txt
Created May 10, 2019 13:05
apr-util on "Red Hat Enterprise Linux Server release 6.10 (Santiago)" - Homebrew build logs
Homebrew build logs for apr-util on "Red Hat Enterprise Linux Server release 6.10 (Santiago)"
Build date: 2019-05-10 09:05:23
@sambrightman
sambrightman / Toggle Keyboard.desktop
Last active October 18, 2018 13:33
Keyboard toggle
[Desktop Entry]
Version=1.0
Type=Application
Name=Toggle Keyboard
Icon=gnome-dev-keyboard
Exec=/home/sam/bin/toggle_keyboard.sh
NoDisplay=false
Categories=Utility;
StartupNotify=false
Terminal=false
@sambrightman
sambrightman / subtree_split.bash
Created August 21, 2018 09:46
Split a Git directory into a different repo with history
# there are probably more efficient ways to do this, but this seems clear and light on low-level commands
# it also does all operations locally until ready to push
cd /path/to/orig_repo
# split off directory into a branch
git subtree split --prefix path/to/subdirectory --branch subdirectory-split
cd /path/to/new_repo
@sambrightman
sambrightman / # freetype - 2018-05-11_12-44-56.txt
Created May 11, 2018 11:45
freetype on Ubuntu 16.04.4 LTS - Homebrew build logs
Homebrew build logs for freetype on Ubuntu 16.04.4 LTS
Build date: 2018-05-11 12:44:56
@sambrightman
sambrightman / # util-linux - 2018-05-11_11-17-12.txt
Created May 11, 2018 10:23
util-linux on Ubuntu 16.04.4 LTS - Homebrew build logs
Homebrew build logs for util-linux on Ubuntu 16.04.4 LTS
Build date: 2018-05-11 11:17:12
@sambrightman
sambrightman / nginx.conf
Created January 12, 2018 11:28
Nginx reverse proxy to private server with SSL and LDAP-based authentication
server {
listen 8000 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
error_page 497 https://$host:$server_port$request_uri;
location /latencies/ {
auth_request /auth-proxy;