Skip to content

Instantly share code, notes, and snippets.

View kidbrax's full-sized avatar

Braxton Beyer kidbrax

View GitHub Profile
@kidbrax
kidbrax / get-totp.sh
Created July 18, 2019 16:32
get TOTP using 1Password #shell
# This uses the 1Passowrd CLI - https://support.1password.com/command-line/
# taken from https://discussions.agilebits.com/discussion/comment/502729/#Comment_502729
# this is a command to get a TOTP, (MFA token)
op get item <item_uuid_or_name> | jq '.details.sections[1].fields[0].v' | awk -F'[=&]' '{print $2}'
@kidbrax
kidbrax / point-in-polygon.rb
Created September 22, 2011 22:43
Check whether a point is within a polygon #ruby
def point_in_polygon?(polygonPoints)
return false if self.latitude.blank? or self.longitude.blank?
polygonPoints.each do |point|
point[0] = point[0].to_f
point[1] = point[1].to_f
end
contains_point = false
i = -1
j = polygonPoints.size - 1
@kidbrax
kidbrax / bundle-to-ebs.sh
Created January 14, 2010 23:56 — forked from fairchild/bundle-to-ebs.sh
bundle instance to ebs #shell
#!/bin/bash -xe
EBS_DEVICE='/dev/sdh'
INSTANCE_ID=$1
AKI=${2:-'aki-5f15f636'}
ARI=${3:-'ari-0915f660'}
ARCH=${4:-'i386'}
SIZE=${5:-10}
AZ=${6:-'us-east-1d'}
NAME=${7:-"ami-from-$INSTANCE_ID"}
@kidbrax
kidbrax / demo.coffee
Last active April 27, 2020 15:27
demo http server #coffee
http = require("http")
PORT = process.env.PORT or 3000
http.createServer((req, res) ->
console.log "%d request received", process.pid
res.writeHead 200,
"Content-Type": "text/plain"
res.end "Hello world!\n"
return
@kidbrax
kidbrax / kit.sh
Last active December 11, 2019 19:25
kitchen alias to keep from retyping regex
# Provides an alias for the kitchen cli - https://docs.chef.io/ctl_kitchen.html
# place the following into your ~/.bashrc or similar
kitchen_specific_instances() {
if [ -z "$WORKING_INSTANCES" ]
then
echo "\$WORKING_INSTANCES is empty"
else
echo "\$WORKING_INSTANCES=$WORKING_INSTANCES"
fi
@kidbrax
kidbrax / create-qr.sh
Last active November 15, 2019 03:31
Creates a QR code simulating Symantec's VIP Access that you can then use in your preferred authenticator
# First install python-vipacess
pip3 install python-vipaccess
# the run it using the defaults
vipaccess provision
# then read the necessary info from the .vipaccess file
CREDENTIAL_ID=$(cat ~/.vipaccess | grep id | awk '{ print $2 }')
CREDENTIAL_SECRET=$(cat ~/.vipaccess | grep secret | awk '{ print $2 }')

Keybase proof

I hereby claim:

  • I am kidbrax on github.
  • I am kidbrax (https://keybase.io/kidbrax) on keybase.
  • I have a public key ASBd14DMFzdIWToaKf0M_jFRpPyQw_Jr6XEfa6tlY2O1oAo

To claim this, I am signing this object:

set -e
set -x
# 1. first, mark old repo as read-only so no new changes are added during transition
# we could script this too through github api. Note, do not lock repo here, since
# git clone will not work if you do.
# Make sure Repo doesn't have any active PRs. DO NOT migrate a repo with active Pull Requests.
# 2. change this. this is the name from <short_name>.git

Keybase proof

I hereby claim:

  • I am kidbrax on github.
  • I am bbeyer (https://keybase.io/bbeyer) on keybase.
  • I have a public key ASDAdmReJbJja-iI_niEPUZTiexJpZN7Y9GSmqhcyYXsUgo

To claim this, I am signing this object:

@kidbrax
kidbrax / github-api.sh
Created January 26, 2018 05:37
useful commands for getting info from Github using their API
# get all private repos whose default branch is master (note pagination)
curl -H "Authorization: token <auth-token>" \
https://api.github.com/orgs/arthrex/repos?type=private \
| jq '.[] | select(.default_branch | contains("master")) | .name, .default_branch'