Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am steve-jansen on github.
  • I am stevejansen (https://keybase.io/stevejansen) on keybase.
  • I have a public key ASA_OhoiYVixB58rBEiRJl_9CcBjl0xT2QsAbM-ponCvsAo

To claim this, I am signing this object:

@steve-jansen
steve-jansen / main.sh
Created Feb 14, 2017
Bulk invite Slack users to a channel
View main.sh
for u in $(jq --raw-output ". | .[]" < members.json); do
clear;
echo Inviting user ${u};
curl -i -X GET "https://slack.com/api/channels.invite?token=${API_TOKEN}&channel=${CHANNEL}&user=${u}" | head -n 20;
sleep 1;
done;
@steve-jansen
steve-jansen / demo.sh
Created Nov 18, 2016
Parse Terraform state file for AWS security group rules
View demo.sh
jq '.modules[].resources | to_entries[] | select(.value.type == "aws_security_group_rule" or .value.type == "aws_security_group")' test.json
@steve-jansen
steve-jansen / WINFILETIME.sh
Created Sep 28, 2016
Convert a Windows FILETIME value to a localized date string
View WINFILETIME.sh
# 131194047065676512 is an example FILETIME value
ruby -e 'puts Time.at((Integer(ARGV[0]) - 116444736000000000) / 10000000)' -- 131194047065676512
@steve-jansen
steve-jansen / .vault
Last active May 1, 2018
HashiCorp Vault Token Helper using the OS X Keychain
View .vault
token_helper = "/Users/me/.vault-helper"
@steve-jansen
steve-jansen / docker-inspect.sh
Created Aug 19, 2016
List labels for a docker container
View docker-inspect.sh
docker inspect -f '{{ range $k, $v := .ContainerConfig.Labels -}}
{{ $k }}={{ $v }}
{{ end -}}' $cid
@steve-jansen
steve-jansen / bookmarklet.js
Last active Aug 19, 2016
Bookmarklet to create a terraform.tfvars file from an Atlas Terraform environment variables page
View bookmarklet.js
javascript:var s='';for(i=0;;i++){k=document.forms[0]["runtime_configuration[tf_vars_attributes]["+i+"][key]"];v=document.forms[0]["runtime_configuration[tf_vars_attributes]["+i+"][value]"]; if(k && v){s+=[k.value,'=',v.value,'\n'].join('');}else{break};};window.location="data:text/plain;base64,"+btoa(s);
@steve-jansen
steve-jansen / mirror-docker-registries.sh
Last active Feb 11, 2021
Mirror a Docker Trusted Registry (DTR) to another registry
View mirror-docker-registries.sh
#!/bin/bash
read -p "Registry to clone from: " pull_registry
read -p "Username for $pull_registry: " user
read -s -p "Password for $pull_registry: " password
echo
read -p "Registry to clone onto: " push_registry
echo Querying $pull_registry...
@steve-jansen
steve-jansen / export-zone.sh
Created Dec 15, 2014
Export DNS records from Rackspace Cloud DNS to zone files on disk
View export-zone.sh
#!/bin/bash
# exports DNS records from Rackspace Cloud DNS to text files
# Depends on https://github.com/wichert/clouddns/blob/master/src/clouddns.py
set -e
me=export-zone
base_domain=
rackspace_region=
rackspace_rate_limit_delay=3
View WRONG.js
var express = require('express'),
proxy = require('./lib/proxy');
var app = express();
app.configure(function() {
app.use(express.favicon(false));
app.use(express.logger('dev'));
app.use(proxy.initialize({
proxy: {