Skip to content

Instantly share code, notes, and snippets.

View sudofox's full-sized avatar
🕟
turning back the clock

Austin Burk sudofox

🕟
turning back the clock
View GitHub Profile
@sudofox
sudofox / listen.py
Created March 28, 2024 16:15
Plays audio from mic over speaker
import pyaudio
import wave
import sys
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
def main():
@sudofox
sudofox / subway_coupons.csv
Last active March 19, 2024 19:51
Subway tends to reuse the same coupon codes or active/deactivate them depending on promotional periods. So I've started collecting them.
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 2.
code,function
6INCHMEAL649,Get a 6" Meal for $6.49
6SUB,Get a 6" Sub for $3.99
899MEAL,Get a Footlong Meal for $8.99
BEVERAGE,FREE Small Fountain Drink when you buy a Footlong
BOGO50,BOGO 50% off Any Footlong
CHIPSFL,FREE Bag of Chips when you buy a Footlong
FL1299,Get TWO Footlongs for $12.99
FL1799,Get THREE Footlongs for $17.99
FL699,Get a Footlong for $6.99
@sudofox
sudofox / README.md
Created March 9, 2023 20:36
this will generate a list of <first 8 chars of sha1 hash of IP>:<IP> mappings.

This will generate a list of <first 8 chars of sha1 hash of IP>: mappings. once sorted, a sorted binary search tool like sgrep can be used to search for sha1-hashed IPs.

I wrote this for some testing of sudofox/mojang-blacklist. unfortunately it does still use like 94 GB of disk space to store the file and it takes a long while to sort that file once it's been generated.

@sudofox
sudofox / dialtone.html
Created January 3, 2023 20:37
US/NANP Precise Tone Plan compliant dial tone generator (html)
<!DOCTYPE html>
<html>
<head>
<title>Dial Tone Generator</title>
</head>
<body>
<button id="startButton">Start</button>
<button id="stopButton">Stop</button>
<script>
const startButton = document.getElementById("startButton");
@sudofox
sudofox / bluebox.html
Last active January 3, 2023 16:33
simple blue box in html/js, not thoroughly tested
<html>
<head>
<script>
function playTones(frequencies) {
// Create an audio context
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
// Create an oscillator for each frequency
var oscillators = frequencies.map(function(frequency) {
var oscillator = audioCtx.createOscillator();
@sudofox
sudofox / perl_hashref_array_filter.pl
Created November 30, 2022 18:40
filter an array of hashrefs for only the fields i want
# as function
sub filter { my $fields = shift; my @results = @_; foreach my $result (@results) { my $replacement = {}; foreach my $field (@$fields) { $replacement->{$field} = $result->{$field}; } $result = $replacement; } return @results; }
# as anonymous func
my $filter = sub {my $fields = shift; my @results = @_; foreach my $result (@results) {my $replacement = {}; foreach my $field (@$fields) {$replacement->{$field} = $result->{$field};} $result = $replacement;} return @results;};
# usages
my @results = $filter->([qw/metadata uuid/], $object->attribute->asHashRefs);
my @results = filter([qw/metadata uuid/], $object->attribute->asHashRefs);
<?php
class Solution {
/**
* @param Integer[] $nums
* @param Integer $target
* @return Integer[]
*/
function twoSum($nums, $target) {
@sudofox
sudofox / ios_webkit_touch_force_support.md
Last active June 25, 2021 20:10
iOS devices supporting force measurements in Webkit
@sudofox
sudofox / touch_force_test.html
Last active June 25, 2021 20:10
used for testing support of touch events/touch force on ios
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Touch force test</title>
<style>
* {
@sudofox
sudofox / drop_dns_deny_rules_on_anyconnect_up.sh
Created December 3, 2020 21:09
Remove/disable cisco anyconnect's UDP port 53 DNS deny rules on the physical interface after connect
#!/usr/bin/env bash
# goes in /etc/NetworkManager/dispatcher.d/
# restart NetworkManager to make sure it takes effect
# watch logs with journalctl -fxe
interface=$1
event=$2
if [[ $interface == "cscotun0" ]] && [[ $event == "up" ]]; then