Skip to content

Instantly share code, notes, and snippets.

@rektide
rektide / README.md
Created Nov 10, 2016
ruby rescue cost
View README.md

What/Why

I as concerned about whether the presence of rescue in Ruby had significant performance impact.

In JavaScript for example try/catch historically has had significant impact itself, even when no exceptions were being thrown.

Based on these benchmarks though, I can see Ruby doesn't seem to have significant cost for defining exception handlers.

Results

@rektide
rektide / README.md
Last active Aug 25, 2016
Use `direnv` instead of systemd
View README.md

Direnv-launch

Systemd is supposed to be the swiss army knife of starting things and keeping them going. For the most part, it works really really well. It has a very flexible developer-friendly way of letting one specify EnvironmentFile's providing environmental variables for programs it's launching.

The major pitfall is that it does not in any way support multi-line values. If you want to pass in a normal boring certificate to your applicatino (because you are a good respectful 12factor dev practicing proper config), you may be S.O.L (shit out of luck).

Thie horrible helper, direnv-launch, lets one use direnv-ish files when launching programs. Direnv's .envrc files can be multi-line, which is great. This is also going to be compatible and useful with your fellow Mac & Windows developers. Note that variables must be declared as export in envrc, as in export FOO=bar, which is different, but closely mimics how everything

@rektide
rektide / become.yml
Last active Jul 28, 2016
become changes ansible_ssh_user
View become.yml
---
- hosts: all
tasks:
# this is created with my username in my homedir
- file: path=~/ansible-become-test state=directory owner="{{ansible_ssh_user}}"
# this is owned by root
- file: path=/opt/ansible-become-test state=directory owner="{{ansible_ssh_user}}"
become: True
@rektide
rektide / battery-one-oh.prom
Created Jul 25, 2016
battery charge, battery voltage, current drain, voltage*current (power)
View battery-one-oh.prom
http://localhost:9090/graph#%5B%7B%22range_input%22%3A%222h%22%2C%22end_input%22%3A%22%22%2C%22step_input%22%3A%22%22%2C%22stacked%22%3A%22%22%2C%22expr%22%3A%22node_power_supply_charge_now%22%2C%22tab%22%3A0%7D%2C%7B%22range_input%22%3A%222h%22%2C%22end_input%22%3A%22%22%2C%22step_input%22%3A%22%22%2C%22stacked%22%3A%22%22%2C%22expr%22%3A%22node_power_supply_voltage_now%22%2C%22tab%22%3A0%7D%2C%7B%22range_input%22%3A%222h%22%2C%22end_input%22%3A%22%22%2C%22step_input%22%3A%22%22%2C%22stacked%22%3A%22%22%2C%22expr%22%3A%22node_power_supply_current_now%22%2C%22tab%22%3A0%7D%2C%7B%22range_input%22%3A%222h%22%2C%22end_input%22%3A%22%22%2C%22step_input%22%3A%22%22%2C%22stacked%22%3A%22%22%2C%22expr%22%3A%22node_power_supply_current_now*node_power_supply_voltage_now%22%2C%22tab%22%3A0%7D%5D
@rektide
rektide / direnv-launch
Created Jul 21, 2016 — forked from mfowlewebs/direnv-launch
~/.bin/direnv-launch
View direnv-launch
#!/bin/zsh
. ./.envrc
eval $*
View foocollector.go
package main
import (
"fmt"
)
type FooCollector struct {
foo string
}
@rektide
rektide / README.md
Last active Mar 23, 2020
Class sugar
View README.md

Class sugar

This project is a reference corpus for exploring similarities and differences in conventional JavaScript inheritance ("Naive"), ES6 Classes ("Classes"), as well as an example of trying to ape classes ("Sugarfree"). It consists of a chart of JavaScript property descriptors where comparison is possible, and of reference implementations of class-like structures/systems, in:

@rektide
rektide / fwd-backs.md
Created Mar 9, 2016
Editor Hotkey Table
View fwd-backs.md

Back/Forward Hotkeys

Browser Primary Secondary
Firefox Alt-← / Alt-→ Control-] / Control-[
Chrome Alt-← / Alt-→
Eclipse Alt-← / Alt-→
Sublime Alt-- / (none)
VS Control-- / Control-+
Atom ??
View weakmaps.md

Weakmap

Maps are a way to store and get values by a key.

var map1= new Map(),
  keySimple = "hello",
  keyComplex = {"hello": true},
map1.set(keySimple, {"to": "world"})
map1.set(keyComplex, {"to": "you"})
@rektide
rektide / gist:2210b1514b79c586449d
Created Jan 14, 2016
OpenShift: my first 15 minutes
View gist:2210b1514b79c586449d
oc project userX-smoke
oc project user16-smoke
oc routes
oc get routes
oc get -h
oc get -h
oc get pods
oc get {pods,replicationController}
oc get pods
oc get replicationController