Skip to content

Instantly share code, notes, and snippets.

View caius's full-sized avatar
👻

Caius Durling caius

👻
View GitHub Profile
provider "triton" {
url = "https://cloudapi.dc1.triton.xxx.cloud"
account = "caius"
key_id = "xxx"
}
data "triton_image" "base-64-lts" {
name = "base-64-lts"
version = "17.4.0"
}
$ ruby -e 'tools = ARGF.read.split.map(&:chomp); puts ("a".."z").map { |l| tools.find {|t| t.start_with?(l) } }' <(ls /bin /sbin | awk 'NF && $1 !~ /:$/ { print $1 }' | sort)
apfs_hfs_convert
bash
cat
date
echo
fibreconfig
halt
ifconfig
@caius
caius / gist:95469afd011717af43c1aff37124f7dd
Created April 23, 2018 17:56
Name one unix tool for every letter of the alphabet, timed.
# 4m 21s
awk
bc
cut
diff
ed
find
grep
history
irb
// Paste in a browser console to randomise the titles of all trello cards
$(".list-card-title").each(function(i, e) {
e = $(e);
t = e.text();
s = "";
for (var i = t.length - 1; i >= 0; i--) {
if (t[i] == " ") {
s += " "
} else {
s += Math.random().toString(36).substring(5, 6);
# Given an input array, find the longest subarray within it (without sort) that contains numbers in ascending order
input = [12, 4, 78, 90, 45, 23]
out = input.length.downto(1) do |i|
subarr = input.each_cons(i).find do |arr|
arr.each_cons(2).map { |a, b| a < b }.uniq == [true]
end
break(subarr) if subarr
end
↳ caius$ curl -vvv https://sendcat.com
* Rebuilt URL to: https://sendcat.com/
* Trying 176.9.78.70...
* TCP_NODELAY set
* Connection failed
* connect to 176.9.78.70 port 443 failed: Operation timed out
* Failed to connect to sendcat.com port 443: Operation timed out
* Closing connection 0
curl: (7) Failed to connect to sendcat.com port 443: Operation timed out
#!/usr/bin/env bash
#
# Syncs pkgsrc releases to manta
#
# MIT License - Caius Durling <[email protected]>
#
[[ "$TRACE" ]] && set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
@caius
caius / notes.sh
Created February 1, 2018 23:45
Homebridge install on base-64-lts 2017Q4 Joyent SmartOS
# Notes on how I installed the zone by hand, hopefully this is enough of a pointer to get
# you up and running!
# Prior art & help found at https://git.frubar.net/bluemaex/homekitten
pkgin install -y gmake gcc49
cat > /root/package.json <<JSON
{
"name": "homebridge-installer",
# Pipe `zfs history` into this script, it will output holds
# which have not yet been released.
holds = []
ARGF.each_line do |line|
next unless line[/zfs (hold|release) (\S+) (\S+)/]
kind = $1
tag = $2
snapshot = $3
require_relative "./shared"
seen_ids = []
$q.subscribe(:block => true, :manual_ack => true) do |delivery_info, metadata, payload|
data = JSON.parse(payload)
p "Got #{data["id"]} (#{data["nack"]})"
if seen_ids.include?(data["id"])
raise "Dup! Already seen this message"