Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Rigsby danrigsby

View GitHub Profile
@danrigsby
danrigsby / gist:8346b842d1446628de5223b600668dca
Created December 12, 2017 14:34
Copy kubernetes secrets between namespaces
View gist:8346b842d1446628de5223b600668dca
kubectl get secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create -f -
@danrigsby
danrigsby / LocalStorage.js
Created November 25, 2015 14:49
React Native Local Storage Wrapper
View LocalStorage.js
import React from 'react-native';
var {
AsyncStorage
} = React;
var LocalStorage = {
get: function (key) {
return AsyncStorage.getItem(key).then(function(value) {
return JSON.parse(value);
});
@danrigsby
danrigsby / peacock.itermcolors
Created May 5, 2015 13:57
iTerm Color Theme: Peacock
View peacock.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.092175714671611786</real>
<key>Green Component</key>
<real>0.078538775444030762</real>
@danrigsby
danrigsby / play.rb
Last active August 29, 2015 14:11
Install Play 2.1.5 via HomeBrew
View play.rb
# Recipe for play-2.1.5
require 'formula'
class Play < Formula
homepage 'http://www.playframework.org/'
url 'http://downloads.typesafe.com/play/2.1.5/play-2.1.5.zip'
# For integrity and security, we verify the hash (`openssl dgst -sha1 <FILE>`)
sha1 '0c92e9c0c0e7ddfba0ef8a2f730c5cbcd6ebc377'
version '2.1.5'
@danrigsby
danrigsby / Angular SetFocus Directive
Created August 25, 2014 23:37
A simple angular directive to set focus to an element
View Angular SetFocus Directive
.directive('setFocus', function ($timeout) {
return function ($scope, $element, $attr) {
if($attr.setFocus !== false) {
var timeout = 750; // wait 750 ms before evaluating
var focus = true;
if ($attr.setFocus) {
// if we have focus criteria, then evaluate it against the scope (ex: set-focus="myValue === 1")
focus = $scope.$eval($attr.setFocus);
}
@danrigsby
danrigsby / install-env-var.sh
Created May 5, 2014 18:47
Bash script to install environment variables globally
View install-env-var.sh
#!/bin/bash
# example: sudo sh ./install-env-var.sh "FOO=bar" "BAR=foo"
for ARG in "$@"
do
echo "*** installing environment variable: $ARG ***"
export $ARG
if ! grep -q "${ARG}" "$HOME/.profile"; then
echo ${ARG} >> $HOME/.profile
@danrigsby
danrigsby / packer-ami-id
Last active December 2, 2022 02:52
Get AMI ID from a packer build
View packer-ami-id
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
@danrigsby
danrigsby / README
Last active August 29, 2015 13:56 — forked from thitemple/dev_setup.ps1
View README
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://gist.githubusercontent.com/danrigsby/9025749/raw/a915773f5812c02aa45185e486ec543e01cf9ed0/dev_setup.ps1'))"