Skip to content

Instantly share code, notes, and snippets.

View randrews's full-sized avatar

Ross Andrews randrews

View GitHub Profile
function guess_fits(guess, clue) {
const guess_freq = frequency(guess)
const clue_freq = frequency(clue)
for (const ltr in clue_freq) {
if (ltr === '?') { continue }
if (!guess_freq[ltr]) { return false } // Clue has a letter the guess doesn't
if (guess_freq[ltr] < clue_freq[ltr]) { return false } // Clue has more of these than guess
guess_freq[ltr] -= clue_freq[ltr]
}
// This will build and run on Borland Turbo C++ with the
// "small" memory model. The declaration of `screen` may
// need to be changed if you use a larger memory model.
// It also may need some changes to build under DJGPP;
// TC++ is... let's say "unique."
#include <conio.h>
#include <dos.h>
#include <mem.h>
.org 0x400 ; start here
jmp start
; Print a string of a certain length
nprint: ; ( addr len -- )
store24 nprint_len
push 0
store24 nprint_off
Ross' status for Winterfest '21:
Thursday evening 2/18:
- Power: been on since last night, supposed to start rolling again at some point but hasn't.
- Internet: tethering to my phone. AT&T's tower is down, I think, I'm getting terrible signal from them through the dish. Google will start throttling me at 22 gigs and I've already used 5 gigs.
- Propane: This morning I got the tank refilled, this is now fine.
- Water: pipes are still burst, plumber knows about it but I can't get him on the phone, this probably will not be fixed until next week at the earliest.
- Food: I have some food. Without water I can't do any dishes. Restaurants are still almost all closed.
@randrews
randrews / fsend
Last active February 14, 2021 20:30
#!/home/randrews/.rbenv/shims/ruby
# WARNING! Remove head completely from rectum before operating!
# This program requires ruby, rubygems, and the serialport gem. Ensure
# that the above shebang line is correct, and that the following two
# requires will work:
require 'rubygems'
require 'serialport'
# This tmux.conf only works with tmux 2.3
# Also you'll really want to install xclip
# Change prefix key to C-a, like screen
set -g prefix C-a
bind C-a send-prefix
unbind C-b
# C-a r to easily reload conf
bind r source-file ~/.tmux.conf \; display "Loaded ~/.tmux.conf"
lpeg = require('lpeg')
-- # Forge Compiler
-- Being a compiler for Forge, a high-level language for the Vulcan computer.
-- ## Parser
-- This iterates over the tokens and line numbers in a file.
-- Pass in an iterator over lines of source (like from io.lines) and
-- successive calls will yield successive tokens.
ARGV = { ... }
json = require('json')
version = 0
user_agent = string.format("'lua:save-scraper:v%s (by /u/randrews)'", version)
username = ARGV[1]
password = ARGV[2]
twofactor_code = ARGV[3]
Dim control_port As Short
control_port = 0x80 'Reset high, everything else low
Put 2, control_port
Dim io_mode As Short
io_mode = 0b10000010 'Ports A and C (both halves) output, B input
Dim lcd_input As Boolean
lcd_input = True 'Ignore this
Call setlcdinput(False)
const next = (n) => [
(n * 10) + 1,
n + 12,
n * 13,
Math.floor(n / 10),
parseInt(n.toString().split('').reverse().join(''), 10)
];
const open = [0];
const goal = 196;