Skip to content

Instantly share code, notes, and snippets.

View rex's full-sized avatar
🧘
Designing calm systems for 20 years. Available.

ᴘɪᴇʀᴄᴇ ᴍᴏᴏʀᴇ™ rex

🧘
Designing calm systems for 20 years. Available.
View GitHub Profile
@rex
rex / Uninstall-Node.sh
Created August 5, 2014 11:16
Completely uninstall Node.js and NPM from a Mac/*Nix machine
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
@rex
rex / Texas-Rangers-emblem.json
Created July 28, 2014 10:19
Texas Rangers baseball team emblem for Battlelog, for use with Battlefield 3, 4+
{
"objects": [{
"asset": "Triangle",
"left": 115,
"top": 291,
"angle": 62.374397494326026,
"width": 31.24619059107534,
"height": 31.24619059107534,
"opacity": 1,
"fill": "#E2020D",
@rex
rex / BrandonsWay.php
Last active August 29, 2015 14:03
S3 Migration Script Challenge
<?php
/*
* Copyright 2013. Amazon Web Services, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@rex
rex / remove_node.sh
Created June 17, 2014 22:23
One-liner to completely remove Node.js and NPM from a machine, as per https://github.com/joyent/node/issues/4058#issuecomment-9204752
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
@rex
rex / aws.zsh
Created May 2, 2014 17:07
AWS Shell One-Liners
#!/bin/zsh
# Determine the instance ID of the current instance
ec2-metadata | awk '/instance-id:/ {print $2}'
# Determine the 'type' of an instance based on the tags applied to it.
ec2-describe-tags | grep $(ec2-metadata | awk '/instance-id:/ {print $2}') | awk '/type/ {print $5}'
@rex
rex / oneliners.zsh
Last active December 31, 2015 21:29
ZSH One-Liners
# List all Homebrew LaunchAgents (*.plist) files
grep -irl --include homebrew\*.plist "" /usr/local/opt
# Count all Homebrew LaunchAgents (*.plist) files
grep -irl --include homebrew\*.plist "" /usr/local/opt | wc -l
# List all registered Vagrant machines
vagrant global-status | ruby -lne 'STDIN.readlines.each {|line| line.match(/^[a-z0-9]{7}/) {|m| puts line } }'
@rex
rex / Artist.csv
Last active December 30, 2015 21:39
7digital Import Row Formats
artistId name popularity tags image url
4 Amy Winehouse 0.68 pop,randb-soul,singer-songwriter,2000s http://cdn.7static.com/static/img/artistimages/00/000/000/0000000004_<$size$>.jpg http://www.7digital.com/artist/amy-winehouse/
@rex
rex / RandexpCSV.rb
Last active December 30, 2015 21:39
Randexp Regex generators
require 'randexp'
#
# String of comma-separated values
#
/(\w{4,10}, ){2,6}\w{4,10}/.gen
# => "colport, antidrag, bahur, fatly"
# => "peak, prudential, pyke, Squaxon, oleous"
alias gll='git stash save --include-untracked && git pull --rebase origin $(current_branch) && git stash pop'
alias gs="git status -sb"
alias peek='git fetch origin $(current_branch) && git lg origin/$(current_branch)'
alias gaa='git add -u .'
alias gpp='echo "Starting push" && git push --all origin $(current_branch) && echo "Pushing Tags" && git push --tags origin $(current_branch) && echo "Push complete"'
alias gr='git reset'
alias grh='git reset --hard'
alias commit='echo "----------- COMMITTING TO BRANCH: $(current_branch) ----------" && gll && gaa && git commit'
alias sync='echo "----------- SYNCING BRANCH: $(current_branch) ------------" && git stash save --include-untracked && git pull --rebase origin $(current_branch) && git push origin $(current_branch) && git stash pop'
@rex
rex / Handlebars_AMD.js
Last active December 19, 2015 16:19
Handlebars precompiled templates output using various different settings (all minified, though, for display)
/*
* handlebars dashboard.hb -f output.js -a
*/
define(['handlebars'], function(Handlebars) {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
return templates['dashboard.hb'] = template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Handlebars.helpers); partials = this.merge(partials, Handlebars.partials); data = data || {};
var buffer = "", stack1, self=this;