Skip to content

Instantly share code, notes, and snippets.

View gigawhitlocks's full-sized avatar
🗽

Ian Whitlock gigawhitlocks

🗽
View GitHub Profile
@gigawhitlocks
gigawhitlocks / main.go
Last active May 11, 2021 14:45
poc program that pipes contents of a zip file through named pipes like they're single-read files
package main
import (
"archive/zip"
"fmt"
"io"
"os"
"sync"
"syscall"
)
@gigawhitlocks
gigawhitlocks / postgres.sh
Created January 23, 2020 00:52 — forked from mrw34/postgres.sh
Enabling SSL for PostgreSQL in Docker
#!/bin/bash
set -euo pipefail
openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod 600 server.key
test $(uname -s) == Linux && echo chown 70 server.key
docker run -d --name postgres -v "$(pwd)/server.crt:/var/lib/postgresql/server.crt:ro" -v "$(pwd)/server.key:/var/lib/postgresql/server.key:ro" postgres:12-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key

Keybase proof

I hereby claim:

  • I am gigawhitlocks on github.
  • I am ianwhitlock (https://keybase.io/ianwhitlock) on keybase.
  • I have a public key whose fingerprint is 17C0 6195 3CBA 8E76 F9C9 9BB5 8941 9A7A 5E79 2775

To claim this, I am signing this object:

The News

Time

date

Calendar

@gigawhitlocks
gigawhitlocks / create_destroy_esx.py
Created February 12, 2016 18:12
example of creating/destroying an ESXi instance in VCA
from pyvcloud.vcloudair import VCA
from pprint import pprint
import os
import time
import uuid
class ESXInstance(object):
def __init__(self, password=os.getenv("vca_password"),
username=os.getenv("vca_username"),
@gigawhitlocks
gigawhitlocks / gif.el
Created January 27, 2016 23:28
emacs gif creator
(defun gif-emacs (duration)
(interactive "sDuration: ")
(start-process "emacs-to-gif" nil
"byzanz-record"
"-d" duration
"-w" (number-to-string (+ 5 (frame-pixel-width)))
"-h" (number-to-string (+ 50 (frame-pixel-height)))
"-x" (number-to-string (frame-parameter nil 'left))
"-y" (number-to-string (+ (frame-parameter nil 'top) 10))
(concat "~/emacs_gifs/" (format-time-string "%Y-%m-%dT%T") ".gif")))
### Keybase proof
I hereby claim:
* I am gigawhitlocks on github.
* I am ianwhitlock (https://keybase.io/ianwhitlock) on keybase.
* I have a public key whose fingerprint is E429 3E94 559A 251A 1C45 AE18 C47C DD6C 4019 B337
To claim this, I am signing this object:
@gigawhitlocks
gigawhitlocks / gist:7453896
Created November 13, 2013 18:28
Opens first argument in a local emacs session that's already running, from the shell on a remote machine.
function evil() {
if [ $SSH_CLIENT ];
then if [[ $1 == /* ]];
then ssh ian@$(echo $SSH_CLIENT | awk '{print $1}') -C emacsclient /ubuntu@isw-dev:$1;
else ssh ian@$(echo $SSH_CLIENT | awk '{print $1}') -C emacsclient /ubuntu@isw-dev:$(pwd)/$1;
fi
else vim;
fi
}
@gigawhitlocks
gigawhitlocks / gist:6607410
Created September 18, 2013 10:39
fizzbuzz
(define fizzbuzz
; this is a default-args wrapper
(lambda ()
(fizzbuzz-iter 1)))
(define fizzbuzz-iter
(lambda (iter)
; the actual meat of fizzbuzz
function sudowoodo() {
read -p "Are you sure? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo mkfs.ext4 /dev/sda
fi
}