Skip to content

Instantly share code, notes, and snippets.

@elasticdog
elasticdog / vault-cp
Created Jul 27, 2018
A script to copy Vault secrets from one path to another
View vault-cp
#!/usr/bin/env bash
# ensure we were given two command line arguments
if [[ $# -ne 2 ]]; then
echo 'usage: vault-cp SOURCE DEST' >&2
exit 1
fi
source=$1
dest=$2
@mjnaderi
mjnaderi / install-arch.md
Last active Nov 18, 2020 — forked from mattiaslundberg/arch-linux-install
Install Arch Linux with Full Disk Encryption (LVM on LUKS)
View install-arch.md
@chrismdp
chrismdp / s3.sh
Last active Nov 5, 2020
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
View s3.sh
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@h12w
h12w / goclean.sh
Last active Aug 13, 2020
golcean.sh does automatic checking on a Go package and its sub-packages.
View goclean.sh
#!/bin/bash
# The script does automatic checking on a Go package and its sub-packages, including:
# 1. gofmt (http://golang.org/cmd/gofmt/)
# 2. goimports (https://github.com/bradfitz/goimports)
# 3. golint (https://github.com/golang/lint)
# 4. go vet (http://golang.org/cmd/vet)
# 5. race detector (http://blog.golang.org/race-detector)
# 6. test coverage (http://blog.golang.org/cover)
set -e
View example.js
// jshint unused:false
/* global console */
var num = 1,
flt = 2.1,
neg = -1,
hex = 0xFF2200,
octal = -01234,
nan = NaN,
nll = null,
@rcrowley
rcrowley / statebird.sh
Created Jul 18, 2013
How to get a reservation at State Bird Provisions
View statebird.sh
set -e
mail() {
echo "$@" |
/usr/bin/mail -a"From: Richard Crowley <r@rcrowley.org>" -s"State Bird Provisions" "1234567890@vtext.com"
echo "$(date): there was a reservation!" >&2
}
TMP="$(mktemp)"
trap "mail \"FAILURE\"; rm -f \"$TMP\"" EXIT INT QUIT TERM
@creationix
creationix / run.js
Last active Nov 27, 2017
A tiny generator helper for consuming callback code directly
View run.js
function run(generator) {
var iterator = generator(resume);
var data = null, yielded = false;
iterator.next();
yielded = true;
check();
function check() {
while (data && yielded) {
@Protonk
Protonk / prng.js
Last active Oct 18, 2019
Various PRNGs, implemented in javascript.
View prng.js
// Linear Congruential Generator
// Variant of a Lehman Generator
var lcg = (function() {
// Set to values from http://en.wikipedia.org/wiki/Numerical_Recipes
// m is basically chosen to be large (as it is the max period)
// and for its relationships to a and c
var m = 4294967296,
// a - 1 should be divisible by m's prime factors
a = 1664525,
// c and m should be co-prime
@howeyc
howeyc / watchalldirs.go
Created Feb 12, 2013
Watch for created directories.
View watchalldirs.go
package main
import (
"log"
"os"
"path/filepath"
"github.com/howeyc/fsnotify"
)
@mwunsch
mwunsch / emoji_image_replace.js
Last active May 6, 2020
Detect emoji unicode on a page, replace it with images (supplied by GitHub, for now). Goes great in your ~/.js
View emoji_image_replace.js
/**
*
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
*
* Much of this code was gleaned from staring at the minified GitHub JS.
*
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
You can’t perform that action at this time.