Skip to content

Instantly share code, notes, and snippets.

Pete Nicholls Aupajo

Block or report user

Report or block Aupajo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile


Basic Security Requirements

3.1.1 Limit system access to authorized users, processes acting on behalf of authorized users, and devices (including other systems).

3.1.2 Limit system access to the types of transactions and functions that authorized users are permitted to execute.

Derived Security Requirements

Aupajo / pre-commit
Created Feb 14, 2018
Check for `.only` in a Git pre-commit hook. Gives you the option to show the diffs and continue with the commit.
View pre-commit
# Exit if any command fails
set -e
function matching_diff {
git diff --staged -G "$match_pattern" $@ -- $file_pattern
Aupajo / app.js
Last active Jan 24, 2018
Continuations in Node
View app.js
const { createNamespace } = require('continuation-local-storage')
const createUUID = require('uuid/v1')
// Application
const logger = require('./logger')
const performSomeProcessing = require('./processing')
// Establish a new storage area for the continuation
const context = createNamespace('context')
View safe-thread-yielding.rb
require 'thread'
def thing_yielder(&block)
things = %i( a b c )
yieldings =
threads = do |thing| do
sleep rand(1..3) # Simulate work
yieldings << thing
View vol
#!/usr/bin/env ruby
# Examples:
# vol Print the current sound volume
# vol 30 Set the volume to 30%
# vol mute
# vol unmute
command = case ARGV.first
when 'mute' then "set volume output muted true"
View audit-heroku-config.rb
#!/usr/bin/env ruby
require "heroku_env_audit"
require "json"
pipelines = JSON.parse(`heroku pipelines --json`, symbolize_names: true)
pipelines.each do |pipeline|
info = JSON.parse(`heroku pipelines:info #{pipeline[:name]} --json`, symbolize_names: true)
View -
[7a184b26-829b-495d-9e5c-b3017321c8d3 28/8065] Giving up after 5 attempts
[480f4644-c203-455b-9c8f-65bc0b8d2cb5 29/8065] Giving up after 5 attempts
[d7557738-a6c1-46f6-b20d-301458d3f80e 140/8065] Giving up after 5 attempts
[d30fac1c-5ef6-40fd-ab48-7eeb7480ff3d 141/8065] Giving up after 5 attempts
[32640d50-702b-4eb0-ae9f-a86615b990cf 143/8065] Giving up after 5 attempts
[0e24188c-6121-4fd5-91e3-45a738d8dbbe 147/8065] Giving up after 5 attempts
[ac1948ce-2469-4490-8bb7-f37f0607165c 151/8065] Giving up after 5 attempts
[990fe96f-b21b-491b-9d77-cf5d695a0c0b 152/8065] Giving up after 5 attempts
[f85cf5b4-5aee-4c6a-83b6-577eceeea9de 153/8065] Giving up after 5 attempts
[7e0f77d7-754e-4f92-a2c1-ecdaf512114a 200/8065] Giving up after 5 attempts
Aupajo / client.rb
Last active Oct 11, 2017
Rack timings
View client.rb
require 'socket'
socket ='localhost', 9292)
puts "Sending headers at #{'%T.%L')}"
socket.puts <<~REQUEST
POST / HTTP/1.1\r
Host: localhost:9292\r
Accept: */*\r
View pancake_constraints.sql
CREATE TABLE pancakes (
/* The order number may be NULL - the kitchen has to eat, too! */
order_number integer UNIQUE,
/* Gotta have syrup */
maple_syrup_brand text NOT NULL,
/* Require order number and maple syrup to be unique */
CONSTRAINT order_syrup UNIQUE (order_number, maple_syrup_brand)


Install with:

curl > /usr/local/bin/box-text && \
chmod u+x /usr/local/bin/box-text


You can’t perform that action at this time.