Skip to content

Instantly share code, notes, and snippets.

View kputnam's full-sized avatar
💭
I have 478 browser tabs open

kputnam kputnam

💭
I have 478 browser tabs open
View GitHub Profile
#!/bin/sh
# either pass a single URL or --input-file=one-url-per-line.txt
wget \
--tries=5 \
--server-response \
--save-headers \
--default-page=index.html \
--adjust-extension \
@kputnam
kputnam / tricks.sh
Last active November 6, 2017 01:38
Bash script tricks
#!/bin/sh
# make sure we aren't running already
what=`basename $0`
for p in `ps h -o pid -C $what`; do
if [ $p != $$ ]; then
exit 0
fi
done
@kputnam
kputnam / bench.rb
Last active April 13, 2022 23:50
Object#cons and Object#snoc benchmarks
#!/usr/bin/env ruby
require "pp"
require "benchmark/ips"
require "memory_profiler"
GC.disable
def mem(label, &block)
result = MemoryProfiler::Reporter.report(&block)
print label.ljust(30); pp result.allocated_memory_by_class