Skip to content

Instantly share code, notes, and snippets.

View dbrock's full-sized avatar

Daniel Brockman dbrock

View GitHub Profile

Keybase proof

I hereby claim:

  • I am dbrock on github.
  • I am dbrock (https://keybase.io/dbrock) on keybase.
  • I have a public key whose fingerprint is 153D 4D87 6BCF E5ED 70E7 E2DD A873 0C39 FE62 2938

To claim this, I am signing this object:

@dbrock
dbrock / genpass.sh
Created May 10, 2014 10:16
Generate memorable passwords ("correct horse battery staple")
genpass() { local w=/usr/share/dict/words; for i in {1..4}; do cat -n $w |
grep -w $(jot -r 1 1 `wc -l <$w`) | cut -f2; done | xargs echo; }
@dbrock
dbrock / s3nuke.sh
Created May 10, 2014 10:09
Delete an AWS S3 bucket and all its contents
s3nuke() { s3cmd ls -r $1 | tee /dev/stderr | cut -c30- |
tr '\n' '\0' | xargs -0 -n4 -P16 -t s3cmd del && s3cmd rb $1; }
@dbrock
dbrock / multiple-heredocs.sh
Last active April 19, 2024 03:18
Sometimes you need to use multiple heredocs in a single command. This is possible in Bash using process substitution.
#!/usr/bin/env bash
cat <<. |
1
.
diff <<. - <(cat) |
2
.
diff <<. - <(cat) |
3
.
@dbrock
dbrock / example.bats
Created October 23, 2013 22:06
Example of the limits of the Bats preprocessor.
# -*- sh -*-
@test "empty input" { diff <<'^D' - <(bin/html </dev/null); }
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
</body>