Skip to content

Instantly share code, notes, and snippets.

View lachie's full-sized avatar

Lachie Cox lachie

View GitHub Profile
@lachie
lachie / please-close.zig
Created February 5, 2022 21:16
problem demo - interrupting a read
const std = @import("std");
const fs = std.fs;
const time = std.time;
pub const io_mode = .evented;
fn portReader(r: fs.File.Reader) !void {
var buf = [_]u8{0} ** 1024;
const std = @import("std");
// Proving to myself the struct should be 14 bytes
// #include <stdio.h>
// #include <stdint.h>
// // /** Never change this, only on major IPC breakage (don’t do that) */
// #define I3_IPC_MAGIC "i3-ipc"
// typedef struct i3_ipc_header {
@lachie
lachie / Gemfile
Created February 18, 2015 05:41
Hm, I thought this would work
source 'https://rubygems.org'
gem 'rspec', '~> 3.1.0'
#!/bin/bash
set -e
set -x
fleetctl destroy $1 || true
fleetctl submit units/$1
fleetctl start $1
fleetctl journal
@lachie
lachie / keybase.md
Created March 1, 2014 00:31
keybase.md

Keybase proof

I hereby claim:

  • I am lachie on github.
  • I am lachie (https://keybase.io/lachie) on keybase.
  • I have a public key whose fingerprint is 66D8 D27A 35C5 4CFD E7DD CE3E 8C2B 8233 59AF C8CB

To claim this, I am signing this object:

root@vagrant-ubuntu-raring-64:~# docker history ruby
IMAGE CREATED CREATED BY SIZE
4107806800c0 2 hours ago /bin/sh -c #(nop) ENV LC_ALL=en_US.UTF-8 939.1 MB
49a2ee12e428 2 hours ago /bin/sh -c #(nop) ENV LANG=en_US.UTF-8 939.1 MB
b61f43bef780 2 hours ago /bin/sh -c cd /blake-install && bash scripts/ 56.32 MB
99a4d0763187 2 hours ago /bin/sh -c cd /blake-install && bash scripts/ 384.1 MB
1b493dea067d 2 hours ago /bin/sh -c cd /blake-install && bash scripts/ 160.7 MB
7c0811d7a569 2 hours ago /bin/sh -c cd /blake-install && bash scripts/ 147.5 MB
869e4754b0ae 2 hours ago /bin/sh -c #(nop) ADD . in /blake-install 104.7 MB
764448da7565 2 hours ago /bin/sh -c sed 's/main$/main universe/' -i /e 199.8 MB
# http://www.columbia.edu/~fms5/ult03.htm
# first 2 paragraphs of Proteus, from Ulysses
corpus = "Ineluctable modality of the visible: at least that if no more, thought through my eyes. Signatures of all things I am here to read, seaspawn and seawrack, the nearing tide, that rusty boot. Snotgreen, bluesilver, rust: coloured signs. Limits of the diaphane. But he adds: in bodies. Then he was aware of them bodies before of them coloured. How? By knocking his sconce against them, sure. Go easy. Bald he was and a millionaire, maestro di color che sanno. Limit of the diaphane in. Why in? Diaphane, adiaphane. If you can put your five fingers through it it is a gate, if not a door. Shut your eyes and see. Stephen closed his eyes to hear his boots crush crackling wrack and shells. You are walking through it howsomever. I am, a stride at a time. A very short space of time through very short times of space. Five, six: the Nacheinander. Exactly: and that is the ineluctable modality of the audible. Open your eyes. No. J
@lachie
lachie / blackmesa.sh
Created September 16, 2012 06:10
Run black mesa on mac
#!/bin/bash
#
# The Stanley Parable Launcher
#
# adapted by @mungler to use an embedded copy of the stanley parable game data
# adapted by @lachie to work with black mesa
# if this is not defined (default), the script will attempt to guess it
STEAMUSERID=""
# if your Steam application is somewhere other than /Applications, edit below.
@lachie
lachie / readme.md
Created September 3, 2012 23:17
JRuby favours scripts on PATH
  • put test.sh into a folder and cd into the folder.
  • put jruby-complete-1.7.0.preview2.jar into same folder, or tweak JRUBY var to point to where it lives.
  • run it with bash test.sh
@lachie
lachie / gist:3073377
Created July 8, 2012 23:10
Luke's 8 queens, edited for style ;)
# Check last queen for conflict
def conflict(p)
i_last = p.length-1
(0..i_last-1).any? {|i|
p[i] == p[-1] || # conflict on col
i-p[i] == i_last-p[i_last] || # conflict on diag
i+p[i] == i_last+p[i_last] # conflict on other diag
}
end