Skip to content

Instantly share code, notes, and snippets.

# Prevent exiting out of the root shell while still allowing it most shells to exit with C-d
setopt ignoreeof
ctrl-d () {
if (( $SHLVL > 1 )); then
exit;
else
zle -M "zsh: use 'exit' to exit"
return 1
#!/bin/bash
# A script to scrape a cloudformation for route53 resources and test them
CAT=`which cat`
DIFF=`which diff`
DIG=`which dig`
NAMESERVER1=""
NAMESERVER2=""
TEMPLATE=""
OUTPUT=0
TMPOUT1="/tmp/$(basename $0)-${RANDOM}"
@sasha1sum
sasha1sum / ppap.hs
Last active December 9, 2016 17:47
module PPAP where
-- Objects are either a unit of something (Thing) or some combination (Union)
data Object = Thing String
| Union Object Object
instance Show Object where
show (Thing name) = name
show (Union a b) = show a ++ "-" ++ show b

Keybase proof

I hereby claim:

  • I am alecgoebel on github.
  • I am agoebel (https://keybase.io/agoebel) on keybase.
  • I have a public key whose fingerprint is C87E E1CA E4CC F114 6E35 D9D0 0DD5 482C C714 8C4D

To claim this, I am signing this object:

@sasha1sum
sasha1sum / checksum.sh
Last active November 21, 2016 17:36
checksum.sh
#!/bin/bash
for f in *; do
echo $f
pv $f | md5sum - | sed "s/-$/$f/" >> checksum.md5
done
@sasha1sum
sasha1sum / vimrc
Created October 14, 2016 17:58
My vimrc 2016-10-14
set autochdir
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Plugins
Plugin 'gmarik/Vundle.vim'
Plugin 'PProvost/vim-ps1'
@sasha1sum
sasha1sum / Makefile
Last active August 23, 2019 09:40
Example of running .NET executables with AWS Lambda and Mono
S3_BUCKET = YOUR_BUCKET
S3_PREFIX = YOUR_PATH
all: build
upload: reverse_cat.zip reverse_cat_cf_template.json
aws s3 cp reverse_cat.zip s3://$(S3_BUCKET)/$(S3_PREFIX)/reverse_cat.zip
aws s3 cp reverse_cat.zip s3://$(S3_BUCKET)/$(S3_PREFIX)/reverse_cat_cf_template.json
build: reverse_cat.zip
@sasha1sum
sasha1sum / README.md
Created May 24, 2016 19:16
Cloudformation and code to create an AWS Lambda to start a jenkins job on github push (via SNS)

Github/Jenkins Hook with AWS Lambda

Setup

  • Run github_hook_cf.py to generate the cloudformation template (requires troposphere).
  • Run the cloudformation template in desired region
  • Once complete, take the values of the outputs and register in Github (Settings -> Webhooks & services -> Amazon SNS), this can be done on a repo or organization level
  • Add the created SNS topic to the generated lambdas event source1
  • Go to the Advanced Settings settings in the lambda configuration and add it to the VPC if needed.2
@sasha1sum
sasha1sum / Natural.hs
Last active June 2, 2016 15:17
Natural.hs: For fun wrote up a definition for natural numbers using recursive types.
module Natural where
data Natural = Zero | Inc Natural
instance Eq Natural where
(==) Zero Zero = True
(==) (Inc a) (Inc b) = a == b
(==) a b = False
instance Ord Natural where
@sasha1sum
sasha1sum / beep-if-low.rb
Created October 26, 2013 19:54
Simple ruby script to print an audible bell when the battery is low on linux.
#!/usr/bin/ruby
$threshold = 20
/Discharging, (\d+)/.match(`acpi`) do |v|
print "\a" if v[1].to_i < $threshold
end