Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍👩‍👧‍👦

Trevor Menagh trevmex

👨‍👩‍👧‍👦
View GitHub Profile
@trevmex
trevmex / magiquest_caseta_arduino_light_toggle.ino
Last active Jul 10, 2018
Arduino code to toggle your lights on and off using a Magiquest wand. Schematics and instructions are available at http://fritzing.org/projects/magiquest-caseta-arduino-light-toggle
View magiquest_caseta_arduino_light_toggle.ino
/*
Copyright 2017 Trevor Menagh
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
Unless required by applicable law or agreed to in writing, software
View seattlerb.challenge.2016.july.5.rb
words = File.readlines("/usr/share/dict/words").map(&:chomp).map(&:downcase)
words.reject! { |word| word.length > 7 }
line = ('a'..'z').to_a.sample(7)
puts line.join(", ")
perm = (1..7).inject([]) { |acc, n|
acc + line.permutation(n).to_a
}
View gist:61f4e10502aa4ee6803f
### Keybase proof
I hereby claim:
* I am trevmex on github.
* I am trevmex (https://keybase.io/trevmex) on keybase.
* I have a public key whose fingerprint is 9E7E 1FCC 1894 727B E845 ADC9 F105 E554 39A1 A7D9
To claim this, I am signing this object:
@trevmex
trevmex / hal+metadata.json
Created May 1, 2014
An example of HAL JSON with Schema.org Metadata
View hal+metadata.json
{
"_type": "http://schema.org/QuantitativeValue/ProcessableOrders",
"_links": {
"self": { "href": "/orders" },
"curies": [{ "name": "ea", "href": "http://example.com/docs/rels/{rel}", "templated": true }],
"next": { "href": "/orders?page=2" },
"ea:find": {
"href": "/orders{?id}",
"templated": true
},
@trevmex
trevmex / 10.9.1.txt
Last active Aug 29, 2015
Mac OS X build failure for gs-rest-service
View 10.9.1.txt
$ uname -a
Darwin 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
$ mvn -version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:22-0400)
Maven home: /usr/local/Cellar/maven/3.1.1/libexec
Java version: 1.6.0_65, vendor: Apple Inc.
@trevmex
trevmex / .vimrc
Created Sep 30, 2013
My first VimL function. It removes all matched lines in a file. Woohoo!
View .vimrc
" :RL <regexp> will now remove all matched lines in a file
function! RemoveLine(regexp)
exe '%s,^.*' . a:regexp . '.*$\n,,g'
endfunction
command! -nargs=1 RL call RemoveLine(<f-args>)
@trevmex
trevmex / cd.sh
Last active Dec 20, 2015
A shell script to read in the env.* variables from a .versions.conf file and replace them while in this directory only. Restores them on exit. This is meant to override `cd.` TODO: Make the cd command actually work...
View cd.sh
#!/usr/bin/env bash
###
# cd override
#
# This replaces the builtin cd command
###
function init_local_env() {
SAVED_VAR=ENV$(echo $1 | sed -e s:/:_:g | tr "[:lower:]" "[:upper:]")_SAVED
@trevmex
trevmex / proposal.json
Created Dec 20, 2012
A proposal for allowing multiple CURIEs in HAL for use in values as well as keys.
View proposal.json
{
"_links": {
"self": { "href": "/" },
"curies": [{
"name": "ex",
"href": "http://www.example.com/rels/{rel}",
"templated": true
},
{
"name": "ot",
@trevmex
trevmex / git_prompt.sh
Created Jul 24, 2012
Add git messaging to your bash prompt
View git_prompt.sh
#
# Colors
#
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NORMAL="\[\033[0m\]"
#
# Prompt Setup
@trevmex
trevmex / up.sh
Created Jun 20, 2012
up - a bash script that updates either a git or an svn repo
View up.sh
#!/usr/bin/env bash
#
# up - a bash script that updates either a git or an svn repo.
#
# Copyright (c) 2012 Trevor Lalish-Menagh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell