View trello_scramble.js
// 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);
View ascending_subarray.rb
# 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
View gist:7910bfeb26528e76b19da5e91742cc63
↳ 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
View pkgsync.sh
#!/usr/bin/env bash
#
# Syncs pkgsrc releases to manta
#
# MIT License - Caius Durling <dev@caius.name>
#
[[ "$TRACE" ]] && set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
View notes.sh
# 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",
View active_zfs_holds.rb
# 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
View client.rb
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"
View feed server.md

Feed Server

Fetcher

  • Reads file containing feed URLs on each line
  • Has a feedstore directory it places data into
  • feedstore is structured
    • {{feed}}.json - file, metadata about the feed, name consistently generated from URL
    • {{feed}} - folder, name consistently generated from URL
      • {{guid}}.json - file, one per item, JSON format, contains item details (optionally .json.gz)
View gist:01947972115c0969bd47ac477cebdb03
TalkTalk: Connecting to host public.srv-9w8cz.gb1.brightbox.com, port 5201
TalkTalk: [ 4] local 2.98.147.132 port 44742 connected to 109.107.37.171 port 5201
TalkTalk: [ ID] Interval Transfer Bandwidth Retr
TalkTalk: [ 4] 0.00-1.04 sec 1.75 MBytes 14.1 Mbits/sec 0 (omitted)
TalkTalk: [ 4] 1.04-2.07 sec 1.75 MBytes 14.2 Mbits/sec 0 (omitted)
TalkTalk: [ 4] 0.00-1.03 sec 1.75 MBytes 14.3 Mbits/sec 0
TalkTalk: [ 4] 1.03-2.03 sec 1.88 MBytes 15.7 Mbits/sec 6
TalkTalk: [ 4] 2.03-3.03 sec 1.50 MBytes 12.6 Mbits/sec 0
TalkTalk: [ 4] 3.03-4.03 sec 1.62 MBytes 13.6 Mbits/sec 0
TalkTalk: [ 4] 4.03-5.03 sec 1.62 MBytes 13.6 Mbits/sec 0
View gist:71e13bc31e87dee0102b324e2918faad
caius@earl:~$ iperf3 -c ping.online.net -p 5205 -B TalkTalk -f m
Connecting to host ping.online.net, port 5205
[ 4] local 2.98.147.132 port 50146 connected to 62.210.18.40 port 5205
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-1.02 sec 2.12 MBytes 17.4 Mbits/sec 2
[ 4] 1.02-2.02 sec 2.12 MBytes 17.8 Mbits/sec 0
[ 4] 2.02-3.03 sec 2.12 MBytes 17.8 Mbits/sec 1
[ 4] 3.03-4.05 sec 2.12 MBytes 17.4 Mbits/sec 1
[ 4] 4.05-5.02 sec 2.12 MBytes 18.3 Mbits/sec 0
[ 4] 5.02-6.05 sec 2.12 MBytes 17.4 Mbits/sec 1