Instantly share code, notes, and snippets.

View setup YubiKey piv.sh
# On a mac
# Double check the README that these are still accurate instructions
git clone git://github.com/arekinath/piv-agent
cd piv-agent
make
# enter password when prompted
make install
# Stick the bit in your profile that it asks you to
View lxd-bootstrap.sh
#!/usr/bin/env bash
exit 1 # don't run as a script y'idiot
# Bootstraps an ubuntu server on HP microserver to run lxd/terraform
# Expects to be run as root by hand. Copy/paste yo!
apt update
apt dist-upgrade -y
View bonnie
root@mc1:~# time bonnie++ -d /tmp -r 512 -u root
Using uid:0, gid:0.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
View fetch_dup.rb
module FetchDup
def fetch(*)
super.dup
end
end
html_options = {
:class => "one",
}
View fails.tf
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"
}
View gist:82179f3d80c06c84aefd3dd99c3358b4
$ 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
View gist:95469afd011717af43c1aff37124f7dd
# 4m 21s
awk
bc
cut
diff
ed
find
grep
history
irb
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