This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updating repository catalogue | |
pkg: Repo "voi" upgrade schema 2006 to 2007: Add conflicts and provides | |
pkg: Repo "voi" upgrade schema 2007 to 2008: Add FTS index | |
pkg: Repo "voi" upgrade schema 2008 to 2009: Optimize indicies | |
pkg: Repo "voi" upgrade schema 2009 to 2010: Add legacy digest field | |
Fetching meta.txz: 100% of 264 B | |
Fetching digests.txz: 100% of 73 KB | |
Fetching packagesite.txz: 100% of 377 KB | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-# pkg upgrade | |
Updating repository catalogue | |
Fetching meta.txz: 100% of 264 B | |
Fetching digests.txz: 100% of 74 KB | |
Fetching packagesite.txz: 100% of 378 KB | |
Removing expired entries: 100% | |
Adding new entries: 100% | |
Incremental update completed, 1557 packages processed: | |
41 packages updated, 1 removed and 3 added. | |
Checking for upgrades: 100% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
D = Struct.new(:month, :day) | |
dates = <<EOC | |
May 15 May 16 May 19 | |
June 17 June 18 | |
July 14 July 16 | |
August 14 August 15 August 17 | |
EOC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'openssl' | |
wordfile = ARGV.first || '/usr/share/dict/words' | |
ct = STDIN.read.unpack('m*').first | |
iv = ct[0..15] | |
ct = ct[16..-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'sequel' | |
DB = Sequel.connect "jdbc:postgresql://localhost/" | |
DB.extension :pg_array | |
DB.run("create temp table foo (bla text[])") | |
x = DB[:foo].prepare(:insert, :foo_insert, bla: :$bla) | |
x.call(bla: Sequel.pg_array(['moo'])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reliably hangs JRuby-9.0.0.0 | |
# jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 OpenJDK 64-Bit Server VM 25.51-b03 on 1.8.0_51-b16 +jit [FreeBSD-amd64] | |
require 'securerandom' | |
Array.new(4).map do | |
Thread.new do | |
100_000.times do |i| | |
print "#{Thread.current.inspect}: #{i}\n" if i % 1000 == 0 | |
key = SecureRandom.random_bytes(4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IMAGE_MAGIC = { | |
'JPG' => 'ffd8', | |
'BMP' => '424d', | |
'TIFF-LE' => '49492a00', | |
'TIFF-BE' => '4d4d002a', | |
'GIF87a' => '474946383761', | |
'GIF89a' => '474946383961', | |
'PNG' => '89504e470d0a1a0a', | |
}.freeze | |
IMAGE_MAGIC_LEN = (IMAGE_MAGIC.values.map(&:size).max / 2.0).ceil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# borg-backup.sh - BorgBackup shell script | |
# | |
# Author: Thomas Hurst <[email protected]> | |
# | |
# No warranty expressed or implied. Beware of dog. Slippery when wet. | |
# This isn't going to be your *only* backup method, right? | |
# | |
# Synopsis: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'digest/sha1' | |
# search a file of "<sha1><crlf>" | |
def sha1_binsearch(io, target, linesize = 42, hashsize=40) | |
low, high = 0, (io.size / linesize) - 1 | |
while low <= high | |
mid = (low + high) / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# pv -cN Input pwned-passwords-2.0.txt | cut -b 1-32 | sort -S 8G | xxd -r -p | pv -cN Output >pwned-passwords-2.0.trunc.bin | |
require 'digest/sha1' | |
def interposearch(io, key) | |
rs = key.size | |
lo = 0 | |
hi = (io.size / rs) - 1 |
OlderNewer