Skip to content

Instantly share code, notes, and snippets.

View robbat2's full-sized avatar

Robin H. Johnson robbat2

View GitHub Profile
test
@robbat2
robbat2 / amazon-signing-debug.py
Last active December 31, 2015 21:29
I think the Amazon S3 Browser POST signature examples are wrong, and thus other code written on them might also be wrong. Here is a testcase that tries to validate the examples.
#!/usr/bin/python
# This attempts to valid the S3 authentication examples given by the Amazon S3
# documentation
# Robin Johnson <robbat2@gentoo.org> 2013/12/19
# http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#RESTAuthenticationExamples
# http://docs.aws.amazon.com/AmazonS3/latest/dev/HTTPPOSTExamples.html#HTTPPOSTExamplesFileUpload
# Testing: API DELETE PASS
# Testing: API GET PASS
# Testing: API PUT PASS
# Testing: API Upload PASS
@robbat2
robbat2 / amazon-signing-debug2.py
Created December 19, 2013 23:28
Another amazon example, this time based on StackOverflow question that gets it right, and showing that amazon is wrong
# first example and code taken from:
# http://stackoverflow.com/questions/9018767/python-generated-signature-for-s3-post
# second set of data taken from amazon official examples
import base64, hmac, sha
private_key = 'uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o'
#input = open("policy.txt", "rb")
#policy = input.read()
policy_encoded = "eyAiZXhwaXJhdGlvbiI6ICIyMDA3LTEyLTAxVDEyOjAwOjAwLjAwMFoiLAogICJjb25kaXRpb25zIjogWwogICAgeyJidWNrZXQiOiAiam9obnNtaXRoIiB9LAogICAgWyJzdGFydHMtd2l0aCIsICIka2V5IiwgInVzZXIvZXJpYy8iXSwKICAgIHsiYWNsIjogInB1YmxpYy1yZWFkIiB9LAogICAgeyJyZWRpcmVjdCI6ICJodHRwOi8vam9obnNtaXRoLnMzLmFtYXpvbmF3cy5jb20vc3VjY2Vzc2Z1bF91cGxvYWQuaHRtbCIgfSwKICAgIFsic3RhcnRzLXdpdGgiLCAiJENvbnRlbnQtVHlwZSIsICJpbWFnZS8iXSwKICAgIHsieC1hbXotbWV0YS11dWlkIjogIjE0MzY1MTIzNjUxMjc0In0sCiAgICBbInN0YXJ0cy13aXRoIiwgIiR4LWFtei1tZXRhLXRhZyIsICIiXSwKICBdCn0K"
expected = "2qCp0odXe7A9IYyUVqn0w2adtCA="
@robbat2
robbat2 / gist:8166121
Created December 29, 2013 00:47
Hung MD on 3.13.0-rc5-00034-gb257bab when scheduling a check of disks
[363692.014637] md: data-check of RAID array md2
[363692.014641] md: minimum _guaranteed_ speed: 1000 KB/sec/disk.
[363692.014642] md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for data-check.
[363692.014645] md: using 128k window, over a total of 131008k.
[363692.873302] md: delaying data-check of md3 until md2 has finished (they share one or more physical units)
[363693.718181] md: delaying data-check of md4 until md2 has finished (they share one or more physical units)
[363694.599760] md: md2: data-check done.
[363694.608141] md: data-check of RAID array md4
[363694.608146] md: minimum _guaranteed_ speed: 1000 KB/sec/disk.
[363694.608147] md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for data-check.
@robbat2
robbat2 / gist:e3e9dd2ef0ec46977625
Last active August 29, 2015 14:02
Subject: Gentoo Infrastructure Hosting Sponsors needed - older sponsors going away
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-dev-announce@lists.gentoo.org
Cc: gentoo-announce@lists.gentoo.org
Reply-To: infra@gentoo.org
Bcc:
Subject: Gentoo Infrastructure Hosting Sponsors needed - older sponsors going away
Hi all,
The world economic climate has not been kind to some of our Gentoo
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-dev-announce@lists.gentoo.org
Cc: gentoo-announce@lists.gentoo.org
Reply-To: infra@gentoo.org
Bcc:
Subject: Gentoo Infrastructure Hosting Sponsors needed - older sponsors going away
Hi all,
The world economic climate has not been kind to some of our Gentoo
@robbat2
robbat2 / keybase.md
Created September 18, 2014 18:45
keybase.md

Keybase proof

I hereby claim:

  • I am robbat2 on github.
  • I am robbat2 (https://keybase.io/robbat2) on keybase.
  • I have a public key whose fingerprint is 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85

To claim this, I am signing this object:

---
base::ssh::ssh_authorized_keys:
base::sshd::sshd_config:
Ciphers:
value:
- chacha20-poly1305@openssh.com
- aes256-gcm@openssh.com
- aes128-gcm@openssh.com
- aes256-ctr
- aes192-ctr
@robbat2
robbat2 / Makefile
Created March 6, 2015 22:50
Makefile for puppet lint & validation (and other filetypes too)
# Puppet validation & lint Makefile
# Copyright 2014-2015 Robin Johnson <robbat2@gentoo.org>
#
# Targets:
# all: does validate, lint, check-footer
# validate: runs validations on many filetypes
# lint: runs puppet-lint only
# check: alias for validate
# validate.${FILETYPE}: validate a specific filetype, eg validate.pp
#
@robbat2
robbat2 / gist:ce7b151d06124d4f270b
Created July 14, 2015 21:29
long metabib.suggest_browse_entries
evergreen=# EXPLAIN ANALYZE VERBOSE SELECT * FROM metabib.suggest_browse_entries( 'empires', 'keyword', 'StartSel="<span class=''oils_AS''>", StopSel=</span>', '75', '10', '14' ) AS "metabib.suggest_browse_entries" ;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Function Scan on metabib.suggest_browse_entries "metabib.suggest_browse_entries" (cost=0.25..10.25 rows=1000 width=79) (actual time=70389.925..70389.928 rows=10 loops=1)
Output: value, field, buoyant_and_class_match, field_match, field_weight, rank, buoyant, match
Function Call: metabib.suggest_browse_entries('empires'::text, 'keyword'::text, 'StartSel="<span class=''oils_AS''>", StopSel=</span>'::text, 75, 10, 14)
Planning time: 0.036 ms
Executi