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"}
@filterfish
filterfish / README.md
Created June 25, 2012 02:49
Debian Unicorn startup script.

A Debian (or any Debian derivative) start up script for unicorn. You will to change: the name of the /etc/{default,init.d}/unicorn to reflect the name of the application; the lines that check and then source /etc/default/unicorn (lines 5 & 6) and the INIT INFO line: "Provides" & "Short-Description" lines (8 & 13). There should be no reason to change anything anything else in /etc/init.d/unicorn.

h2.Bundler

You might find that bundler just works (unlikely) or (more likely) you will have to fuck around until it does. So if it doesn't work the following:

  • add ruby_path=/bin to /etc/defaults/unicorn
  • sed 's/^DAEMON=.*$/DAEMON=$ruby_path/bundle exec unicorn"

probably will.

@filterfish
filterfish / pipe-client.rb
Created December 2, 2011 23:55
EventMachine Pipe Clinet/Server
#!/usr/bin/env ruby
require 'pathname'
uri = ARGV[0] || (puts "usage: #{$0} <uri>"; exit 1)
Pathname.new('pipe').open("w") do |fd|
fd.puts(uri)
end