Skip to content

Instantly share code, notes, and snippets.

View greyltc's full-sized avatar
💭
I may be slow to respond.

M. Greyson Christoforo greyltc

💭
I may be slow to respond.
View GitHub Profile
@greyltc
greyltc / make_holes.py
Created August 20, 2021 10:39
python holemaker
#!/usr/bin/env python3
"""script that puts holes into pcb"""
import pcbnew
class HoleMaker(object):
"""puts holes into a pcb, units are mm"""
board_filename = None
pcb = None
@greyltc
greyltc / search-for-primes.py
Created February 5, 2021 17:38
multi process version of the prime number counter from https://www.youtube.com/watch?v=hGyJTcdfR1E
import multiprocessing as mp
import time
#max number to look up to
max_number = 10000
#four processes per cpu
num_processes = mp.cpu_count() * 4
def chunks(seq, chunks):
@greyltc
greyltc / sbplot.py
Last active September 22, 2024 18:19
plot seabreeze
#!/usr/bin/env python3
# a live plotter for oceanoptics spectrometers
# needs https://github.com/ap--/python-seabreeze
# written by [email protected]
# python3 <(curl -sL https://gist.github.com/greyltc/7bc7d916976e48b3d2fa991444b9cc1e/raw)
from seabreeze import spectrometers
import numpy as np
@greyltc
greyltc / launch-GRD.sh
Last active February 25, 2025 08:02
configures then activates gnome-remote-desktop from the command line
#!/usr/bin/env bash
# run this on the remote terminal machine, as auser with sudo powers, probably through a remote ssh shell
# this will overwrite all the settings it touches
# the name of the user to run these commands as
TARGET_USER=jane
# we need an inlocked desktop session. we can either start a new autologin one or unlock an existing one
@greyltc
greyltc / installed.txt
Created January 18, 2020 12:45
opkg list installed
# opkg list_installed
acme - 2.8.3-2
base-files - 212-r11955-b97247c2e9
brcm2708-gpu-fw - 2019-12-11-0c01dbefba45a08c47f8538d5a071a0fba6b7e83
brcm2708-userland - 42ec119e03eb8dffc7c83e2ac0e665e333abbef6-1
brcmfmac-firmware-usb - 20191215-1
busybox - 1.31.1-1
ca-bundle - 20190110-2
cgi-io - 16
cypress-firmware-43455-sdio - v4.14.77-2019_1031
@greyltc
greyltc / linux-gpib.patch
Created January 17, 2020 17:54
a patch to get the linux gpib kernel driver working (thank you robots)
Index: linux-gpib-kernel/drivers/gpib/fmh_gpib/fmh_gpib.c
===================================================================
--- linux-gpib-kernel/drivers/gpib/fmh_gpib/fmh_gpib.c (revision 1862)
+++ linux-gpib-kernel/drivers/gpib/fmh_gpib/fmh_gpib.c (working copy)
@@ -982,7 +982,7 @@
}
/* Match callback for driver_find_device */
-static int fmh_gpib_device_match(struct device *dev, void *data)
+static int fmh_gpib_device_match(struct device *dev, const void *data)
@greyltc
greyltc / key_notes.md
Last active April 15, 2023 10:22
ssh/pgp key management notes

install keybase packages

keybase kbfs

login

keybase login greyltc

import pgp key from keybase

@greyltc
greyltc / backup_vbox_to_scratch.sh
Last active September 1, 2019 20:22
solar sim vm backup script
#!/usr/bin/env bash
echo ""
echo "=====Before backing up, ensure the following====="
echo "1: All removable drives are unmounted from the VM"
echo "2: All VM snapshots are gone (rolled into the base disk image)"
echo "3: The VM has been properly shut down"
echo "4: VirtualBox is not running"
echo ""
@greyltc
greyltc / comms_test.py
Last active July 4, 2019 17:27
gpib comms test
import visa
rm = visa.ResourceManager()
rn = 'GPIB0::24::INSTR'
inst = rm.open_resource(rn)
first_idn = inst.query("*IDN?")
print(f'Instrument identified as {first_idn.strip()}')
q = 0
q_max = 100000
# this will search every file recursively for the follwing strings: "0.0055" "0.0060" "0.0065" "0.0069" "0.0072"
grep -r -A4 0.0055 . | grep -B1 -A3 0.0060 | grep -B2 -A2 0.0065 | grep -B3 -A1 0.0069 | grep -B4 0.0072
# it will return 4 line matches where the strings are on different consecutive lines and appear in that order
grep -r -A2 0.8521 . | grep -B1 -A1 0.8217 | grep -B2 0.791