Skip to content

Instantly share code, notes, and snippets.

@benfoxall
benfoxall / instructions.md
Created May 20, 2011 09:46
apache vhosts
[user]
email = home@example.com
# override if a remote matches org name
[includeIf "hasconfig:remote.*.url:git@github.com:ORG-NAME/**"]
path = ~/.gitconfig.work
@benfoxall
benfoxall / resetMacAddr.sh
Last active August 8, 2022 08:47
Reset MAC address (for rejoining time-limited wifi)
# turn off wifi
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
# set mac address to random value
NEW_MAC=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
sudo ifconfig en0 lladdr $NEW_MAC
@benfoxall
benfoxall / generate.sh
Last active March 31, 2022 15:15
Generate video of satellite imagery
# Extract frames from GEOS Image Viewer to generate a video
# https://www.star.nesdis.noaa.gov/goes/fulldisk_band.php?sat=G16&band=GEOCOLOR&length=12&dim=1
mkdir -p images output
BASE=https://cdn.star.nesdis.noaa.gov/GOES16/ABI/FD/GEOCOLOR/
DIM=1808x1808
curl $BASE \
| grep -o -e "\".*GEOCOLOR-$DIM.jpg\"" \
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<nav>
<ol>
@benfoxall
benfoxall / extract-functions.js
Last active January 29, 2022 11:08
Extract functions from js source code
import { opendir, readFile } from 'fs/promises';
import { join } from 'path'
import * as parser from "@babel/parser";
import _traverse from "@babel/traverse";
const traverse = _traverse.default;
for await (const file of allFiles('javascript')) {
if (file.endsWith('.js')) {
const buffer = await readFile(file)
@benfoxall
benfoxall / favicon.js
Created May 22, 2021 13:48
Favicon setter
const set = favicon()
set('🐝')
//
function favicon() {
const link = document.createElement('link')
link.rel = 'icon'
document.head.appendChild(link)
@benfoxall
benfoxall / emoji.js
Created May 17, 2021 20:16
Function for parsing emoji sequences
//
// https://unicode.org/Public/emoji/13.0/emoji-sequences.txt
export function* emojiList(sequences) {
const LINES = /^[0-9A-F\.\ ]*;/mg;
const TRAILER = /\W+;$/;
const RANGE = /(.*)\.\.(.*)/;
for (const line of sequences.match(LINES)) {
@benfoxall
benfoxall / unicorn-draw.html
Created May 15, 2021 20:25
A page for drawing on the Pi Pico Unicorn Pack over WebUSB – https://twitter.com/benjaminbenben/status/1379361185703849987
<html>
<head>
<title>
pico serial
</title>
<style>
body {
font-family: sans-serif;
display: flex;
## Hacky pomodoro script for pi pico
from math import floor
import picounicorn
from machine import Pin, Timer
picounicorn.init()
w = picounicorn.get_width()