Skip to content

Instantly share code, notes, and snippets.

View hexagon5un's full-sized avatar

Elliot Williams hexagon5un

View GitHub Profile
#! /bin/env bash
[ $# -eq 0 ] && echo "Usage: randomNIST number_contestants [pulseIndex]" && exit
[ $# -eq 1 ] && number_contestants=$1 && pulseIndex=last
[ $# -eq 2 ] && number_contestants=$1 && pulseIndex=$2
# convert to hexadecimal
number_contestants=$(echo "ibase=10 ; obase=16 ; $number_contestants" | bc)
randomHex=$(curl https://beacon.nist.gov/beacon/2.0/chain/2/pulse/${pulseIndex} | grep outputValue | cut -d \" -f 4)
#!/bin/bash
clear
# init colors
FG="#00ffff"
BFG="#00ff00"
# if you wonder why true is in there https://www.shellcheck.net/wiki/SC2015
gum confirm --default --affirmative="Play now" --negative="Dump source first" --timeout=10s "Would you like to view the source code before playing?" && true || ( gum format -t code <"$0" )
# get initial info
gum style --foreground "$FG" --border-foreground "$BFG" --border double --align center --width 64 --margin "1 2" --padding "2 4" \
@hexagon5un
hexagon5un / 3Play.py
Created February 24, 2023 14:26
Horrible code from ages ago
#! /usr/bin/env python
## Simple controller shell to interface with MPC with minimal keystrokes
## Note: ssh -p 23 -L 6600:audiobox:6600 elliotwilliams.org
## makes it work from remote locations. Tunnels into my network. :)
import mpdclient2, time, pdb, curses, os
import cPickle as pickle
## os.system("export MPD_HOST='audiobox'")
@hexagon5un
hexagon5un / spacemouse.py
Created January 11, 2023 16:42
Quick and dirty Spacemouse test
#! /usr/bin/env python3
import serial
import subprocess
SENSITIVITY=250
PORT1="/dev/ttyUSB1"
DEBUG = False
DELAY = 0.25 ## seconds, prevents race
@hexagon5un
hexagon5un / randomImage
Created November 18, 2022 17:00
Random number from webcam and hash
#! /bin/env bash
number_contestants=$1
# convert to hexadecimal
number_contestants=$(echo "ibase=10 ; obase=16 ; $number_contestants" | bc)
# take image
ffmpeg -f v4l2 -i /dev/video0 -frames:v 1 -y foo.png
# md5sum it and extract the value
@hexagon5un
hexagon5un / skull_n_wrenches5_nobg-shrinkwrap.svg
Created May 10, 2022 09:20
Hackaday Logo, Jolly Wrencher SVG, No Background
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hexagon5un
hexagon5un / skull_n_wrenches5_bg.svg
Last active May 10, 2022 09:18
Hackaday Jolly Wrencher in SVG, On Black Background
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
h_space = 57 / 7; // 8 LEDs = 7 gaps
v_space = 58.3 / 7;
gap = 1.5;
height = 2;
rotate([180,0,0]){
difference(){
translate([0,0,4.5/2])
cube([69, 69, 4.5], center=true);
// circuit board cutout
@hexagon5un
hexagon5un / read-more-hackaday.hex
Created September 20, 2019 10:04
AVR/Arduino Hex Compiled Audio Experiment
:100000000C9401010C941E010C941E010C941E0111
:100010000C941E010C941E010C941E010C941E01E4
:100020000C941E010C941E010C941E010C94ED0105
:100030000C941E010C941E010C941E010C941E01C4
:100040000C94A3010C941E010C941E010C941E012F
:100050000C941E010C941E010C941E010C941E01A4
:100060000C941E010C941E010000000025002800C5
:100070002B0000000000240027002A0004040404D0
:100080000404040402020202020203030303030342
:10009000010204081020408001020408102001021F
@hexagon5un
hexagon5un / gcodesender.py
Created April 15, 2019 14:54
gcodesender.py with "improved" defaults
#!/usr/bin/python
"""\
Simple g-code streaming script
https://github.com/bborncr/gcodesender.py/blob/master/gcodesender.py
"""
import serial
import time
import argparse