Skip to content

Instantly share code, notes, and snippets.

View nathanielks's full-sized avatar

Nathaniel nathanielks

View GitHub Profile
@nathanielks
nathanielks / keybase.md
Created October 15, 2021 22:00 — forked from webframp/keybase.md
Signing git commits on github using keybase.io gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key

@nathanielks
nathanielks / README.md
Last active April 4, 2023 07:08
These scripts are for use with https://github.com/humanmade/cf-to-tf.

CloudFormation -> Terraform Import Helpers

I wrote these scripts to help faciliate batch import of our CloudFormation templates into Terraform Configuration.

region-batch.sh

This script is a light wrapper around batch.sh. It simply iterates over the list of regions provided, exports expected variables, creates required directories, and calls batch.sh.

BASE_DIR=/path/to/dir EXCLUDE_REGEX="(some-stack-production|some-stack-staging)" ./region-batch.sh us-east-1 us-west-1
@nathanielks
nathanielks / https-setup.md
Last active March 14, 2023 23:40 — forked from indolering/https-setup.md
Shell script to generate TLS certificates for local development (.test, .example, etc)
@nathanielks
nathanielks / delete_expired_sessions.sql
Created September 29, 2016 17:31
SQL query to delete expired WooCommerce Sessions.
delete from t1, t2
using wp_options t1
join wp_options t2 on t2.option_name = replace(t1.option_name, '_expires', '')
where (t1.option_name like '\_wc\_session\_expires\_%')
and t1.option_value < UNIX_TIMESTAMP(NOW())
# /etc/init/personal-vnc.conf
# Use the service command:
# sudo service personal-vnc {start,stop,restart,status}
#
description "Manages VNC connection. Runs on boot"
start on runlevel [2345]
stop on runlevel [06]
# $ cat template.json | PACKER_LOG=1 packer build -debug -
2016/03/12 13:23:31 [INFO] Packer version: 0.9.0 a643faae672ec8b8424352476d2b91b7a7f7b06e+CHANGES
2016/03/12 13:23:31 Packer Target OS/Arch: darwin amd64
2016/03/12 13:23:31 Built with Go Version: go1.6
2016/03/12 13:23:31 Detected home directory from env var: /Users/aang
2016/03/12 13:23:31 Using internal plugin for vmware-vmx
2016/03/12 13:23:31 Using internal plugin for docker
2016/03/12 13:23:31 Using internal plugin for parallels-pvm
2016/03/12 13:23:31 Using internal plugin for qemu
// polyfill webpack require.ensure
if (typeof require.ensure !== 'function') require.ensure = (d, c) => c(require)
export default <% if (addStore) { %>(store) => (<% } %>{
path: '<%= camelEntityName %>',
getComponents (location, cb) {
require.ensure([
'views/<%= pascalEntityName %>View/<%= pascalEntityName %>View'
], (require) => {
let view = require('views/<%= pascalEntityName %>View/<%= pascalEntityName %>View').default
@nathanielks
nathanielks / calc.js
Created November 27, 2015 02:50
Super simple way to calculate how long an egghead.io course is
var seconds = 0;
$('.table.table-condensed .info-line small.duration').each(function(){
var s = this.innerText.split(':');
seconds += s[0] * 60;
seconds += s[1] * 1;
});
console.log(seconds/60);
@nathanielks
nathanielks / README.md
Last active June 3, 2023 17:24
Simple wrapper around terraform to manage multiple environments

This script will pull down an S3 remote configuration before running any terraform actions. Assumes the following structure:

main.tf
terraform.cfg
env/dev/vars
env/staging/vars
env/whatever/vars
env/whatever/somefile.tf

Keybase proof

I hereby claim:

  • I am nathanielks on github.
  • I am nathanielks (https://keybase.io/nathanielks) on keybase.
  • I have a public key whose fingerprint is E5F6 FFB4 3651 D39A 25B9 1DAD FE02 07A3 8BD5 4DC4

To claim this, I am signing this object: