Skip to content

Instantly share code, notes, and snippets.

View cHemingway's full-sized avatar

Chris Hemingway cHemingway

View GitHub Profile
@cHemingway
cHemingway / find_new_devices.py
Created July 20, 2025 17:42
Script to find new devices on your local network using arp-scan, useful to SSH into something you just plugged in
# Script to find new devices on your local network, useful to SSH into something you just plugged in
# Written by Github Copilot
import argparse
import subprocess
import sys
import json
import re
from pathlib import Path
import random
import webbrowser
import torch
import torch.utils.data
import ignite
from ignite.engine import create_supervised_trainer, Events
from ax.service.managed_loop import optimize
from ax.plot.contour import plot_contour
import torch
from torch.utils.data import DataLoader, TensorDataset
import ignite
from ignite.engine import create_supervised_trainer, Events
from ignite.contrib.handlers import ProgressBar
device = torch.device('cpu')
# device = torch.device('cuda') # Uncomment this to run on GPU

Keybase proof

I hereby claim:

  • I am chemingway on github.
  • I am chemingway (https://keybase.io/chemingway) on keybase.
  • I have a public key whose fingerprint is 54B7 26B3 DF30 D6C6 0325 AE07 D50F CC6B A89A 82B0

To claim this, I am signing this object:

@cHemingway
cHemingway / watercooler_light.sh
Last active June 24, 2019 11:30
Turns Kraken X61 LED off on system suspend
#!/bin/bash
# Script to turn Kraken X61 light off on suspend
# Chris Hemingway 2019, MIT License
# Place under /lib/systemd/system-sleep/ on Debian/Ubuntu
# See https://blog.christophersmart.com/2016/05/11/running-scripts-before-and-after-suspend-with-systemd/
# Uses levctl, must be installed globally $ sudo -H pip3 install --upgrade leviathan pyusb
if [ "${1}" == "pre" ]; then
# Turn fan off
levctl -s 40 -m off -q
@cHemingway
cHemingway / led_flash
Created June 21, 2019 08:56
Put this under /etc/watchdog.d, make it executable, and it will be ran by the watchdog automatically
#!/bin/bash
# Chris Hemingway 2019
# Script to flash LED every time watchdog runs, using kernel transient led trigger support
# Path to your LED device here
LED=/sys/devices/platform/leds/leds/orangepi:red:status
if ! [[ -f /tmp/watchdog_led_begun ]] ; then #Run setup only once
echo transient > $LED/trigger
echo 500 > $LED/duration
@cHemingway
cHemingway / flac_check.sh
Last active January 2, 2022 18:30
Check output of flac_convert.sh
#!/bin/bash
# Script to check if flac_convert did it correctly
# Compares MD5 of audio stream using ffmpeg
# Chris Hemingway 2019, MIT License
#
# Requires GNU parallel, please ensure you cite this in your research as they request
function compare_audio {
hash1=$(ffmpeg -hide_banner -i "$1" -map 0:a -f md5 - 2>/dev/null)
hash2=$(ffmpeg -hide_banner -i "$2" -map 0:a -f md5 - 2>/dev/null)
# echo "$1=$hash1 $2=$hash2" # uncomment to see md5 of each file
@cHemingway
cHemingway / flac_convert.sh
Last active June 20, 2019 20:04
Convert all wav files in a directory into flac
#!/bin/bash
# Script to covert all wav files to flac in parallel folder structure
# Chris Hemingway 2019, MIT License
#
# For VCTK corpus, but could easily be used with others
# Requires GNU parallel, please ensure you cite this in your research as they request
INDIR="wav48"
OUTDIR="flac48" # Presumes on same level as INDIR
set -e #Exit on first error
echo "Creating directory $OUTDIR"
#! /usr/bin/env python2
"""oscillo.py: Port of windytan's oscillo.pl to python.
Requires Sox (for resampling), PIL/Pillow, and Numpy
Original script: https://gist.github.com/windytan/5276653
"""
import argparse
import subprocess
import struct
INFO: Initializing raylib (v1.5.0)
INFO: Trying to enable MSAA x4
INFO: Display device initialized successfully
INFO: Display size: 1366 x 768
INFO: Render size: 800 x 450
INFO: Screen size: 800 x 450
INFO: Viewport offsets: 0, 0
INFO: OpenGL 3.3 Core profile supported
INFO: GPU: Vendor: Intel Inc.
INFO: GPU: Renderer: Intel HD Graphics 5000 OpenGL Engine