Skip to content

Instantly share code, notes, and snippets.

Avatar

Jaap Broekhuizen jaapz

View GitHub Profile
View Kaifa Smart Meter Telegram
/KFM5KAIFA-METER
1-3:0.2.8(42)
0-0:1.0.0(160525195716S)
0-0:96.1.1(4530303235303030303539393336303136)
1-0:1.8.1(000001.117*kWh)
1-0:1.8.2(000004.020*kWh)
1-0:2.8.1(000000.000*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(00.341*kW)
@jaapz
jaapz / destructuring.js
Last active Nov 12, 2015
object destructuring in es6
View destructuring.js
// simple destructuring without default
let obj = {bananaphone: 'hello?'};
let {bananaphone} = obj;
console.log(bananaphone); // hello?
// destructuring with default
let {missingkey = 'hey?'} = obj;
console.log(missingkey); // hey?
View keybase.md

Keybase proof

I hereby claim:

  • I am jaapz on github.
  • I am jaapz (https://keybase.io/jaapz) on keybase.
  • I have a public key ASDhauBBIob-8oo_8Ngge8gvF2lTyXaGQhQUyspuRpcQ4go

To claim this, I am signing this object:

@jaapz
jaapz / dmenu-4.5-xft-width-xy.diff
Last active Aug 29, 2015
dmenu 4.5 patch containing xft, x and y positioning and window width
View dmenu-4.5-xft-width-xy.diff
diff --git a/config.mk b/config.mk
index 92a5e63..9cff5db 100644
--- a/config.mk
+++ b/config.mk
@@ -12,9 +12,13 @@ X11LIB = /usr/X11R6/lib
XINERAMALIBS = -lXinerama
XINERAMAFLAGS = -DXINERAMA
+# Xft, comment if you don't want it
+XFTINC = -I/usr/include/freetype2
@jaapz
jaapz / breaks.rs
Last active Aug 29, 2015
Why does this happen?
View breaks.rs
struct Record {
name: String,
message: String,
}
// Let's say `record` is an instance of Record, with strings in name and message.
// This will work correctly:
let message =
@jaapz
jaapz / sorting.py
Last active Aug 29, 2015
sorting a list using itemgetter
View sorting.py
from operator import itemgetter
mylist = [
["Some", "Data", "30.0", 12.10],
["Foo", "Bar", "29.5", 90.00],
["Fizz", "Buzz", "29", 13.12]
]
# Sorting using a field that already has a nice sortable type (for example, a float).
my_sorted_list_4 = sorted(mylist, key=itemgetter(3))
View .xinitrc
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
@jaapz
jaapz / cb-exit.py
Last active Nov 1, 2015
cb-exit for crunchbang with jessie repo's
View cb-exit.py
#!/usr/bin/env python
# Replace the old /usr/bin/cb-exit with this one.
import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass
View todo.js
$(function() {
"use strict";
// Model. Als toggle gecalled word zal done geinvert worden. Ook word de titel aangepast zodat de view opnieuw rendert.
var Todo = Backbone.Model.extend({
defaults: {
title: "Something to remember",
done: false
},
@jaapz
jaapz / test.py
Last active Jan 2, 2016
Monkeypatch builtins for use in py.tests
View test.py
import __builtin__
def test_raw_input(monkeypatch):
""" Get user input without actually having a user type letters using monkeypatch """
def mock_raw_input(*args, **kwargs):
""" Act like someone just typed 'yolo'. """
return 'yolo';
monkeypatch.setattr(__builtin__, 'raw_input', mock_raw_input)
You can’t perform that action at this time.