Skip to content

Instantly share code, notes, and snippets.

@philr
philr / rbx_strftime.rb
Last active January 23, 2018 21:16
Calling super from a method in an included module can invoke the wrong superclass (https://github.com/rubinius/rubinius/issues/3783)
module Extension
def strftime(format)
super('%Y')
end
end
class ExtendedTime < Time
include Extension
end
@philr
philr / gist:4e65c8e1d0a1357ae7f6133f749b4324
Last active October 13, 2016 16:43
GlobalSign revoked intermediate certificate OCSP response
Hypertext Transfer Protocol
GET /rootr1/MEwwSjBIMEYwRDAJBgUrDgMCGgUABBS3V7W2nAf4FiMTjpDJKg6%2BMgGqMQQUYHtmGkUNl8qJUC99BM00qP%2F8%2FUsCCwQAAAAAAURO8DYx HTTP/1.1\r\n
Host: ocsp.globalsign.com\r\n
\r\n
[Full request URI: http://ocsp.globalsign.com/rootr1/MEwwSjBIMEYwRDAJBgUrDgMCGgUABBS3V7W2nAf4FiMTjpDJKg6%2BMgGqMQQUYHtmGkUNl8qJUC99BM00qP%2F8%2FUsCCwQAAAAAAURO8DYx]
[HTTP request 1/1]
[Response in frame: 114]
Hypertext Transfer Protocol
HTTP/1.1 200 OK\r\n
Date: Thu, 13 Oct 2016 14:19:59 GMT\r\n
@philr
philr / run-rsnapshot
Created December 28, 2015 18:14
Run all required rsnapshot intervals based on the date they were last run
#!/bin/bash
CONF_FILE=/etc/rsnapshot.conf
if [ $# -lt 1 ]
then
echo "Usage: $0 interval1:dateformat1 interval2:dateformat2 ..." >&2
echo >&2
echo " Where intervaln is an rsnapshot retain interval and dateformatn is a" >&2
echo " format letter to be passed to date. If the intervaln.0 ctime formatted" >&2
@philr
philr / test_open3.txt
Created January 21, 2015 23:22
test/mri/test_open3 with jruby 9.0.0.0.pre1 (2.2.0p0) 2015-01-21 ac0d512 OpenJDK 64-Bit Server VM 24.65-b04 on 1.7.0_65-b32 +jit [linux-amd64]
Loaded suite test/mri/test_open3
Started
.F
===============================================================================
Failure: <nil> is not true.
test_capture2(TestOpen3)
test/mri/test_open3.rb:143:in `test_capture2_46'
===============================================================================
F
===============================================================================
@philr
philr / energenie
Created December 29, 2014 19:08
Command line program to control Energenie remote controlled sockets on the Raspberry Pi
#!/usr/bin/python
import sys
from energenie import switch_on, switch_off
def arg_error():
sys.stderr.write("Usage: {0} 1-4|all on|off\n".format(sys.argv[0]));
sys.exit(1)
if len(sys.argv) != 3:

Keybase proof

I hereby claim:

  • I am philr on github.
  • I am philr (https://keybase.io/philr) on keybase.
  • I have a public key whose fingerprint is 9100 EB87 EECC 034E 3C8C ED3A DAE8 B2D6 DFB2 4AC6

To claim this, I am signing this object:

# Replacements for the Rack::Utils parse_query and normalize_params methods.
# Code is from Rack 1.1.0 with the patch at
# http://github.com/rack/rack/commit/dae12e088592ee69545b5f2f81b87f4959859164
# applied.
#
# Fixes a bug where pairs of quotes in parameter values cause the parameter
# to be truncated. See:
# https://rails.lighthouseapp.com/projects/8994/tickets/4808-textarea-input-silently-truncated-in-238
rack_spec = Gem.loaded_specs['rack']