Skip to content

Instantly share code, notes, and snippets.

View craigw's full-sized avatar
🦄

Craig R Webster craigw

🦄
View GitHub Profile
@craigw
craigw / aws_delete-default-vpc.sh
Last active December 15, 2021 15:19 — forked from jokeru/aws_delete-default-vpc.sh
Script to delete all AWS default VPCs from all regions using AWS CLI
#!/usr/bin/env bash
set -euo pipefail
for AWS_REGION in $(aws ec2 describe-regions --region eu-west-1 --query '[Regions[].RegionName]' --output text); do
echo -n "* Region ${AWS_REGION}: "
export AWS_REGION
# get default vpc
vpc=$(aws ec2 describe-vpcs --filter Name=isDefault,Values=true --query "Vpcs[0].VpcId" --output text)
@craigw
craigw / keybase.md
Created February 11, 2017 15:04
keybase.md

Keybase proof

I hereby claim:

  • I am craigw on github.
  • I am craigwebster (https://keybase.io/craigwebster) on keybase.
  • I have a public key ASBtbJEQX1uuqAkkrLpmMEFVixUivMlhR1sEV1PZS2raNQo

To claim this, I am signing this object:

new-session -s Default
set-option -g default-shell $SHELL
set -g default-terminal "screen-256color"
set -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION"
# Status bar
set -g status-bg black
set -g status-fg white
@craigw
craigw / sha256.h
Last active August 29, 2015 14:01 — forked from ezodude/NSString+SO.m
- (uint8_t *)SHA256;
1.
Dell 1425
3GHz Intel Xeon - not sure which model
Unknown RAID card - either Dell or 3ware - with 2x80GB disks
3G RAM
2.
Dell 1435
1.8Ghz AMD Operton 2210
RAID card may be broken. No drives.
require 'benchmark'
class Foo
attr_accessor :a
def a
@a = a
end
end
class Bar < Struct.new(:b)
## Why?
# Because I frequently have to shift numbers to denser encodings to pass around,
# Ruby can't handle base 62 natively, I don't like the base 62 encoders that
# monkey patch stdlib... but mostly because I can.
class BaseNumber < Struct.new(:representation, :base)
def to_s
representation
end
craig@zuu 0 ruby-1.9.3-p194 ~$ ruby ./example.rb 1>example.out 2>&1
craig@zuu 0 ruby-1.9.3-p194 ~$ cat ./example.out
STDERR
STDOUT
craig@zuu 0 ruby-1.9.3-p194 ~$ ruby ./example.rb 2>example.err 1>example.out
craig@zuu 0 ruby-1.9.3-p194 ~$ cat example.err
STDERR
craig@zuu 0 ruby-1.9.3-p194 ~$ cat example.out
STDOUT
class Foo
def bar
rand(10).to_s
end
end
# My interface is the same as Foo because I just decorate that behaviour
class FooDecorator
attr_accessor :other
private :other=, :other