Skip to content

Instantly share code, notes, and snippets.

View jorisroovers's full-sized avatar

Joris Roovers jorisroovers

View GitHub Profile
require "httparty"
require 'yaml'
require 'digest/sha1'
require 'slop'
########################################################################################################################
# CLI Parsing
# $varname = global variable (dollar sign = global var, accessible in functions)
$opts = Slop.parse do |o|
o.string '-d', '--dest', 'destination', default: "_data/shares.yml"
substitutions:
dnsname: jeroentest
deviceid: jeroentest
devicename: Jeroen Test
esphome:
name: ${dnsname}
platform: ESP32
board: esp32dev
# Some custom options required for AZ Delivery board
### Keybase proof
I hereby claim:
* I am jorisroovers on github.
* I am jorisroovers (https://keybase.io/jorisroovers) on keybase.
* I have a public key whose fingerprint is 131D 6B20 28B1 4515 79FA EFA8 C7F9 7EE7 DD03 DB74
To claim this, I am signing this object:
@jorisroovers
jorisroovers / functions.sh
Created June 4, 2014 12:55
Generic bash snippets
# Asserts that the script was invoked with valid arguments
assert_usage(){
if [ $# -ne 1 ]; then
echoerr "Usage: $0 (start | start | develop)"
exit 1
fi
}
#!/bin/bash
# Set the ubuntu user password to something useable for VNC/KVM console access
passwd ubuntu <<EOF
ubuntu
ubuntu
EOF
# Since we have non-secure Dynamic DNS updates available in the ctocllab domain
# this will update a ctocllab.cisco.com entry
#!/bin/bash
source ${openrc:-~/openrc}
ext_net=${ext_net:-external}
no_gw=${no_gw:-nogw}
hostname=${1:-test}
key_name=${key_name:-public}
flavor=${flavor:-2}
image=${image:-precise-x86_64}
user_data=${user_data:-~/user.data}
net_id=`neutron net-list | grep ${ext_net} | awk -F' ' '{print $2}'`
@jorisroovers
jorisroovers / new_gist_file.sh
Created October 24, 2013 10:06
Linux Commands
#Installing old gnome
sudo apt-get install gnome-session-fallback
#(might need a sudo-apt get update first)
#Login to commandline
#To Commandline: CTRL+ALT+F1
#Back to Login: CTRL+ALT+F7
#Release info
@jorisroovers
jorisroovers / blink-element.js
Created October 2, 2013 13:37
Requires jquery
// runner
function Runner() {
this.descriptionDefer = $.Deferred();
this.descriptionPromise = this.descriptionDefer.promise();
}
Runner.prototype.stop = function() {
this.descriptionDefer.resolve(this.descriptionDefer);
}
@jorisroovers
jorisroovers / animate-element-snap-svg.js
Created October 2, 2013 11:22
Relies on pathAnimator.js and d3.js
// requires snap-svg.js
function animateOverPath(el, path, duration, callback) {
len = path.getTotalLength();
Snap.animate(0, len, function (l) {
var dot = path.getPointAtLength(l);
x = dot.x - el.getBBox().width/2;
y = dot.y - el.getBBox().height/2;
el.attr({
transform: "t" + [x,y] + "r" + (dot.alpha - 180)
});