This file contains hidden or 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
--- freebsd-update.sh.orig 2018-12-13 16:28:44.343075728 +0000 | |
+++ freebsd-update.sh 2018-12-13 16:44:41.440009430 +0000 | |
@@ -1059,6 +1059,30 @@ | |
# Print user-friendly progress statistics | |
fetch_progress () { | |
+ if [ "$1" -gt 0 -a -t 1 ]; then | |
+ fetch_progress_tty $1 | |
+ else | |
+ fetch_progress_classic |
This file contains hidden or 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
# require "divebar/version" | |
module Divebar | |
Style = Struct.new(:name, :tick_chars, :progress_chars, :template) | |
module Styles | |
Default = Style.new( | |
"default", | |
"⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈ ".chars, | |
"█░".chars, | |
" %<bar>s %<spinner>s %<pos>d/%<len>d %<msg>s" |
This file contains hidden or 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
module IpTest | |
module V4 | |
MAX_LEN = '255.255.255.255'.size | |
SEGMENT = /(?:25[0-5]|(?:2[0-4]|1?[0-9])?[0-9])/ | |
PATTERN = /#{SEGMENT}\.#{SEGMENT}\.#{SEGMENT}\.#{SEGMENT}/ | |
PATTERN_ANCHORED = /\A#{PATTERN}\z/ | |
def self.contains?(str) | |
PATTERN.match?(str) | |
end |
This file contains hidden or 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
/// Email Sucks Completely / Email Search Command | |
extern crate mailparse; | |
extern crate tantivy; | |
extern crate walkdir; | |
use mailparse::*; | |
use tantivy::collector::TopCollector; | |
use tantivy::query::QueryParser; |
This file contains hidden or 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 | |
# frozen_string_literal: true | |
require_relative 'ragios' | |
Listener = Struct.new(:user, :command, :pid, :fd, :proto, :local_addr, :foreign_addr) do | |
def to_s | |
"#{user}/#{command} (#{pid}) on #{local_addr}" | |
end | |
end |
This file contains hidden or 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
module Rustish | |
module Result | |
ResultMisuse = Class.new(StandardError) | |
FailedUnwrap = Class.new(ResultMisuse) | |
ExpectationFailed = Class.new(ResultMisuse) | |
Empty = Object.new | |
module InstanceMethods |
This file contains hidden or 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
Index: stat.c | |
=================================================================== | |
--- stat.c (revision 336221) | |
+++ stat.c (working copy) | |
@@ -202,6 +202,30 @@ | |
(*nl) = ((c) == '\n'); \ | |
} while (0/*CONSTCOND*/) | |
+static struct passwd * | |
+cached_getpwuid(uid_t uid) |
This file contains hidden or 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
# unmodfile.rb: Unpack a Starshatter data file | |
require 'zlib' | |
require 'ftools' | |
Header = Struct.new(:magic, :file_count, :index_size, :super_secret_drm_key, :index_offset) | |
Entry = Struct.new(:filename, :size_unpacked, :size, :offset) | |
File.open(ARGV[0] || 'shatter.dat', 'rb') do |f| | |
hdr = Header.new(*f.read(20).unpack("i5")) | |
f.pos = 20 + hdr.index_offset |
This file contains hidden or 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 |
This file contains hidden or 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 |