Skip to content

Instantly share code, notes, and snippets.

Caius Durling caius

Block or report user

Report or block caius

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View output.txt
# Unique headers
GNU "Terry Pratchett", Terry Pratchett
GNU #1
GNU Aaron Swartz
GNU Aaron Swartz, Boris Floricic, Wau Holland, Stephen Hawking
GNU Arthur William Bell III, Natalie Nguyen, Terry Pratchett, Chris Long, Howard Gobioff
GNU Douglas Adams, Terry Pratchett, Lester Haines
GNU GNU: Terry Pratchett, Jon Postel, Dennis Ritchie, Evi Nemeth, Ray Tomlinson, Evelyn Berezin
GNU Jerry Jackowski, Natalie Nguyen
GNU John Dearheart
View backup1.txt
| backup1 | RUNNING | 10.0.0.99 (eth0) | 2a02:8010:62f1:2:216:3eff:fe50:6cec (eth0) | PERSISTENT | 0 |
| | | 10.0.0.98 (eth0) | | | |
| | | 10.0.0.95 (eth0) | | | |
| | | 10.0.0.93 (eth0) | | | |
| | | 10.0.0.92 (eth0) | | | |
| | | 10.0.0.90 (eth0) | | | |
| | | 10.0.0.9 (eth0) | | | |
| | | 10.0.0.89 (eth0) | | | |
| | | 10.0.0.88 (eth0) | | | |
| |
View shadowing.rb
@things = [1]
def foo
@things.first
end
foo # => 1
unless foo
foo = 2
View to_int.rb
module ToInt
def to_int
return unless self
i = to_i
i if self == i.to_s
end
end
String.include(ToInt)
NilClass.include(ToInt)
View block-less.rb
require "benchmark/ips"
Benchmark.ips do |r|
r.report("block argument, not yielded") do
m = Module.new do
def foo(&block)
end
module_function :foo
end
View length_partition.rb
# Content-Length, Worker index, Worker total count
length, index, count = ARGV.first(3).map(&method(:Integer))
slice, remainder = length.divmod(count)
min = index * slice
max = if index == (count - 1)
# Final slice finishes on total size
length
else
# One less than next slice starting point
((index + 1) * slice) - 1
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",
}
You can’t perform that action at this time.