Skip to content

Instantly share code, notes, and snippets.

View chrisroos's full-sized avatar

Chris Roos chrisroos

View GitHub Profile
@chrisroos
chrisroos / README.md
Created April 19, 2016 05:31
Differences between assert/refute and assert_equal true/false

Exploring the differences between the use of assert / refute versus assert_equal true / assert_equal false.

Nginx proxy to signed S3 URLs

  • Backend app sets X-Accel-Redirect header to a location that nginx is configured to handle (e.g. /s3-proxy/)

  • Backend app generates signed URL and stores it in HTTP header

  • Backend app stores s3 host in separate HTTP header

  • nginx location (e.g. /s3-proxy/) extracts content from HTTP headers and proxies requests to S3

Debugging nginx config

  • Use the debug log level to the error_log directive

    • I think this writes to the log for all requests, not just errors.
  • Use return 302 http://localhost to force a redirect to localhost.

  • Use add_header to write debug info to HTTP headers for later inspection

  • AMI: ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-20170727 (ami-1e749f67)
  • t2.large instance
$ sudo apt-get update
$ sudo apt-get install -y git

$ sudo apt-get install -y gcc build-essential
$ sudo apt-get install -y libssl-dev libreadline-dev zlib1g-dev
  • I noticed for the first time this morning that the buttons on the left and right of the screen are to move forward through the book. I'd previously assumed they were for moving backward and forward through the book.

  • I plugged the device into my laptop and copied a PDF (printed from Pocket) to the documents folder. This showed up on the homescreen and I was able to read it.

  • I changed the email address for my device to something more friendly and emailed a PDF (printed from Pocket) to it. It showed up on the homescreen of my Kindle in no time. And shows up in "My Content" at Amazon.com.

ubuntu@ip-172-30-0-184:~/asset-manager$ ab -n1000 "http://asset-manager.ec2.gov.uk/media/597a14f18456ae0dfd5ad8b8/1MB.dat"
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking asset-manager.ec2.gov.uk (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
@chrisroos
chrisroos / README.md
Last active July 27, 2017 11:38
2017-07-26 Asset Manager Performance Testing

Creating files of n size

dd if=/dev/zero of=1MB.dat  bs=1m count=1

Upload file to Asset Manager

Using IFTTT to handle future and recurring tasks

  • Store the tasks in our "GFR Tasks" Google calendar.

    • Relatively fine grained control over dates of tasks (e.g. second Wednesday of each month)
  • IFTTT applet turns these events into cards in Trello

    • Our applets
    • "If any event starts on GFR Tasks, then create a card in - Go Free Range board"
    • Fires 15 minutes before the start date of a task, i.e. 23:45 for all day tasks
@chrisroos
chrisroos / google-api-docs-offline.md
Created September 9, 2011 12:08
Using wget to create offline copies of Google API docs

I've used this in the past to grab offline copies of some of the Google API docs.

$ wget --no-parent --recursive --page-requisites --html-extension --convert-links "http://code.google.com/apis/gears/"

# --no-parent - Don't fetch anything in the parent directory of the URL specified
# --page-requisites - Download everything required for the page to display correctly
# --recursive - Recursively download (use default depth of 5)
# --html-extension - Add .html to downloaded html files (this isn't necessarily required for the google code example but might be useful on other sites)

--convert-links - Update links in the downloaded document to point to, either the downloaded copy of a file or a full URL