Skip to content

Instantly share code, notes, and snippets.

View ErikDeBruijn's full-sized avatar

Erik de Bruijn ErikDeBruijn

View GitHub Profile
CmdUtils.makeSearchCommand({
name: "qrcode",
description: "Generates a QR Code from the current document URL or what you've tpyed after the command. Useful to quickly get something onto your phone.",
homepage: "http://www.erikdebruijn.nl/",
author: {name: "Erik de Bruijn", email: "ubiquity@erikdebruijn.nl"},
license: "GPLv2",
takes: {"input": /.*/},
preview: function(pblock, input) {
var atext;
atext = input.object.html.toString();
@ErikDeBruijn
ErikDeBruijn / glass.html
Created March 17, 2014 21:18 — forked from bwhite/glass.html
[wearscript] Warp view
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WS.scriptVersion(1)) return;
WS.displayWarpView()
WS.cameraOn(.25, 360, 640);
}
window.onload = main;
</script>
#### A faster way to (interactively) delete some messages interactively on the rails console
#messages = Message.find(:all,:conditions => ["recipient_id = 3 and updated_at < ?", 20.days.ago])
messages = Message.find(:all,:conditions => ["recipient_id = 3"])
messages.each do |m|
input = ''
if m.content.include? "also commented on your comment" do
m.delete
next
end
puts "#{m.subject} #{m.created_at}"
require 'sinatra'
require 'socket'
server = TCPServer.new 35666 # Server bound to port 35666, just like EE
set :port, 8080
hull = 42
shields = 80
@ErikDeBruijn
ErikDeBruijn / tesla-finish-charge-at.js
Last active January 29, 2016 22:35
A little script to finish charging my car just before I want to leave
#!/usr/bin/node
/*
This script does four things for Tesla Model S owners:
- it helps increase battery longevity
- saves money if your utility charges night-time power differently
- gives you a more pleasant start of your drive
- preheats for you in the morning, no need to open up the App.
How?
You tell it when it should complete its charge and what percentage.
@ErikDeBruijn
ErikDeBruijn / vagrant2.plugin.zsh
Created April 17, 2015 09:56
oh-my-zsh plugin to use v as a shortcut for vagrant and allow you to quickly execute commands within the vm
v () {
vagrant_commands=(box connect destroy global-status halt help init login package plugin provision rdp reload resume share ssh ssh-config status suspend up version)
if [[ ${vagrant_commands[(r)$1]} = $1 ]]
then
vagrant $*
else
vagrant ssh -c "$*"
fi
}
@ErikDeBruijn
ErikDeBruijn / SlaveUMBoard.ino
Last active September 4, 2018 18:52
SlaveUMBoard Sketch
#include "settings.h"
#include "pins.h"
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Slave Ultiboard Ready.");
pinMode(SAFETY_TRIGGERED_PIN,OUTPUT);
pinMode(J25_PIN1,INPUT);
pinMode(J25_PIN2,INPUT);
@ErikDeBruijn
ErikDeBruijn / autolights.lua
Last active December 17, 2019 20:04
HC2 lua scripts
--[[
%% autostart
%% properties
11 value
1002 value
1003 value
1004 value
1005 value
1006 value
1007 value
@ErikDeBruijn
ErikDeBruijn / fibaroweb.rb
Created March 12, 2017 20:52
Fibaro to API.ai bridge for Google Home integration
require 'yaml'
require 'pp'
require 'sinatra'
require 'open-uri'
require 'json'
enable :sessions
$config = YAML::load_file('./config.yaml')
configure do
@ErikDeBruijn
ErikDeBruijn / seed-split.py
Created September 21, 2017 21:11
seed spitting
# ==== The dilemma: security versus access ====
# Nervous writing down your valuable seed phrase on a piece of paper?
# But worried that if you don't, you might lose access?
#
# ==== The easy (risky) way out ====
# Very commonly, people split their seed phrase in x equal parts, however,
# THIS IS VERY INSECURE. An attacker that obtains even one split has
# significantly easier job of compromising your key and steal to your
# crypto assets/currencies.
#