Skip to content

Instantly share code, notes, and snippets.

View gwbischof's full-sized avatar
🧐
Learning

Garrett Bischof gwbischof

🧐
Learning
View GitHub Profile
@gwbischof
gwbischof / github_user_comments_and_context.sh
Created June 25, 2025 21:10
Get all comments for a user on GH along with the context
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: $0 <username>"
echo "Example: $0 octocat"
exit 1
fi
USERNAME="$1"
OUTPUT_FILE="${USERNAME}_comments.json"
@gwbischof
gwbischof / update_resource_spec.py
Last active November 20, 2024 22:12
CLI to update a Bluesky Resource document spec field
import argparse
import pymongo
import sys
def update_resource_spec(mongo_uri, resource_uid, new_spec, wet_run):
client = MongoClient(mongo_uri)
collection = client.get_database()["resource"]
print(f"Updating resource spec {'(dry_run)' if not wet_run else ''}")
@gwbischof
gwbischof / lemmy-sso.md
Last active September 13, 2024 23:04
Lemmy SSO Support Dev Setup

1. Checkout lemmy:sso-support branch

# Switch to privacyguard:sso_support branch.
cd lemmy
git remote add privacyguard [email protected]:privacyportal/lemmy.git
git fetch --all
git switch sso_support
git submodule init && git submodule update --remote
@gwbischof
gwbischof / bluesky_queue.md
Last active October 19, 2023 21:14
Remote Bluesky Queue

Serverless Bluesky Queue Concept

Create a RunEngine and a Scheduler

import sched
import time

from bluesky import RunEngine
from ophyd.sim import noisy_det
@gwbischof
gwbischof / skully.py
Created September 23, 2023 17:17
Skully
from scipy.io import wavfile
import matplotlib.pyplot as plt
import numpy as np
import pyfirmata
import pyaudio
import wave
import time
vocals = '/Users/gbischof/Downloads/Bush-Machinehead-Isolated-Vocals.wav'
full = '/Users/gbischof/Downloads/Bush-Machinehead.wav'
@gwbischof
gwbischof / device_plotter.py
Created March 16, 2023 21:14
ophyd device plotter
def plot_ophyd_device(device, dont_plot={'ramp_rate'}):
'''
Plot all of the signals of an ophyd device.
There is probably some inaccuracy of the timestamps.
Simple implementation.
'''
history = {signal: [getattr(device, signal).get()]
for signal in set(device.component_names) - dont_plot}
history['timestamp'] = [time.time()]
print(set(device.component_names) - dont_plot)
import time
import threading
from simple_pid import PID
class ThermalMaterial:
"""
A material that you can heat and cool.
import time
import threading
class ThermalMaterial:
"""
A material that you can heat and cool.
Parameters
----------
thermal_mass: float, optional
@gwbischof
gwbischof / bsui.sh
Last active October 19, 2023 20:42
. /Users/gbischof/miniconda3/etc/profile.d/conda.sh
if [ ! -z "$BS_PYTHONPATH" ]; then
if [ ! -z "$PYTHONPATH" ]; then
export PYTHONPATH=$PYTHONPATH:$BS_PYTHONPATH
else
export PYTHONPATH=$BS_PYTHONPATH
fi
fi