Skip to content

Instantly share code, notes, and snippets.

View filterfish's full-sized avatar

Richard Heycock filterfish

View GitHub Profile
@filterfish
filterfish / prune-cabal
Last active January 15, 2021 06:44
Script to clean up the cabal store
#!/bin/zsh
setopt extended_glob
# Find the basename for every input line
function filter {
while read i; do print $i:t:s/\.conf/; done
}

"HTTP Cookies" were first half-baked by Netscape Communications Corporation and allow clients to retain certain state information to be included in future requests to a particular server. Most modern web clients can metabolize cookies. Cookies are now defined by RFC 6265. It is not necessary to use/permit cookies to read articles on arXiv.org.

@filterfish
filterfish / crash.log
Created May 10, 2018 14:26
terraform-dns-segv
2018/05/11 00:21:19 [INFO] Terraform version: 0.11.7 41e50bd32a8825a84535e353c3674af8ce799161
2018/05/11 00:21:19 [INFO] Go runtime version: go1.10.1
2018/05/11 00:21:19 [INFO] CLI args: []string{"/home/rgh/bin/terraform-0.11.7", "apply", "--auto-approve"}
2018/05/11 00:21:19 [DEBUG] Attempting to open CLI config file: /home/rgh/.terraformrc
2018/05/11 00:21:19 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/05/11 00:21:19 [INFO] CLI command args: []string{"apply", "--auto-approve"}
2018/05/11 00:21:19 [INFO] command: empty terraform config, returning nil
2018/05/11 00:21:19 [DEBUG] command: no data state file found for backend config
2018/05/11 00:21:19 [DEBUG] New state was assigned lineage "ac22b346-a1b6-1211-d523-6b5b5feb07c9"
2018/05/11 00:21:19 [INFO] command: backend initialized: <nil>
@filterfish
filterfish / password-reset
Last active January 16, 2016 14:11
Simple script to reset a user's password
#!/bin/zsh
username=$1
password=$2
db=synapse-homeserver
[[ -z $username ]] || [[ -z $password ]] && { print "usage: $0 <username> <password>"; exit; }
password_hash=$(python -c "import bcrypt; print bcrypt.hashpw(\"$password\", bcrypt.gensalt())")
{
"config": [
{
"key": "maniphest.default-priority",
"source": "local",
"value": null,
"status": "unset",
"errorInfo": null
},
{
2016/01/11 21:36:38 [error] 17946#0: *3389 FastCGI sent in stderr: "PHP message: [2016-01-12 08:36:38] EXCEPTION: (PhutilTypeExtraParametersException) Got unexpected parameters: maniphest.default-priority at [<phutil>/src/parser/PhutilTypeSpec.php:150]
PHP message: arcanist(head=stable, ref.master=4d6d3feb7fc1, ref.stable=6833ae5bd33e), phabricator(head=stable, ref.master=6d404c821902, ref.stable=2e7f2b735702), phutil(head=stable, ref.master=12bd645b58b9, ref.stable=f51205748260)
PHP message: #0 <#2> PhutilTypeSpec::checkMap(array, array) called at [<phabricator>/src/applications/maniphest/constants/ManiphestTaskPriority.php:144]
PHP message: #1 <#2> ManiphestTaskPriority::validateConfiguration(array) called at [<phabricator>/src/applications/maniphest/config/ManiphestPriorityConfigOptionType.php:7]
PHP message: #2 <#2> ManiphestPriorityConfigOptionType::validateOption(PhabricatorConfigOption, array) called at [<phabricator>/src/applications/config/option/PhabricatorApplicationConfigOptions.php:24]
PHP
@filterfish
filterfish / riemman-alert.rb
Created December 24, 2015 03:14
riemann flapping — II
require 'riemann/client'
DEFAULT = {:host => 'ch01', :metric => nil, :service => "serf", :ttl => 10}
CLIENT = Riemann::Client.new
def event(e)
CLIENT << DEFAULT.merge(e).tap { |p| puts "#{Time.now} — #{e}" }
end
delay = (ARGV[0] || 2).to_i
@filterfish
filterfish / riemann.clj
Created December 22, 2015 11:38
riemann flapping
(udp-server {:host "::"})
(periodically-expire 1)
(let [index (index)]
(streams
index
(match :service #"^serf"
(changed-state {:init "ok"}
traceroute to <host> (<ip addr>), 30 hops max, 60 byte packets
1 192.168.7.1 (192.168.7.1) 1.130 ms lns20.syd6.on.ii.net (150.101.199.159) 23.889 ms 192.168.7.1 (192.168.7.1) 1.135 ms
2 lns20.syd6.on.ii.net (150.101.199.159) 25.223 ms 26.224 ms 27.827 ms
3 xe-0-0-1.cr1.syd4.on.ii.net (150.101.195.138) 29.365 ms 30.807 ms 32.019 ms
4 lns20.syd7.on.ii.net (150.101.195.14) 32.486 ms 33.934 ms 35.337 ms
5 te3-1-120.cor2.syd6.on.ii.net (150.101.199.241) 36.642 ms 37.821 ms 39.470 ms
6 te4-1.cor2.syd6.on.ii.net (150.101.120.226) 40.460 ms 23.936 ms 25.134 ms
7 xe-0-2-1.cr1.syd4.on.ii.net (150.101.197.2) 26.207 ms 26.945 ms 28.618 ms
8 lns20.syd7.on.ii.net (150.101.195.14) 29.774 ms 30.949 ms 31.684 ms
9 te3-1-120.cor2.syd6.on.ii.net (150.101.199.241) 34.049 ms 35.369 ms 36.124 ms
### Keybase proof
I hereby claim:
* I am filterfish on github.
* I am filterfish (https://keybase.io/filterfish) on keybase.
* I have a public key whose fingerprint is F5B0 52EC 4A87 7DE1 018F 522A C844 E023 1400 0CBC
To claim this, I am signing this object: