Skip to content

Instantly share code, notes, and snippets.

@jboecker
jboecker / gist:5123578
Last active December 14, 2015 17:39
Bookmarklet to create a custom printable view of zeit.de "Um die Ecke gedacht" riddles (use jscompress.com to get it to a manageable size for a bookmarklet)
var jQuery, document;
function f() {
'use strict';
var title = jQuery("span.title"),
image = jQuery("#main > div.article-body > div.block > img"),
across = jQuery("#main > div.article-body > p")[1],
down = jQuery("#main > div.article-body > p")[2],
b,
imgwidth;
import itertools
first=list("abcd")
second=list("1234")
third=list("WXYZ")
step1 = map("".join, itertools.product(first, second))
step1_combinations = itertools.product(step1, repeat=len(third))
for combo in step1_combinations:
@jboecker
jboecker / output.txt
Created August 2, 2013 17:49
rdflib-sqlalchemy test case
<rdflib.plugins.memory.IOMemory object at 0x2370310> namespaces after creation:
[('xml', rdflib.term.URIRef(u'http://www.w3.org/XML/1998/namespace')),
('rdf', rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#')),
('xsd', rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#')),
('rdfs', rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#'))]
('<rdflib.plugins.memory.IOMemory object at 0x2370310>', 'namespaces after loop:')
[('xml', rdflib.term.URIRef(u'http://www.w3.org/XML/1998/namespace')),
('rdf', rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#')),
('ex', rdflib.term.URIRef(u'http://example.com/ns/ex#')),
/* PS2Keyboard library example
Adapted to control (parts of) the A-10C CDU keyboard
through DCS-BIOS.
PS2Keyboard now requries both pins specified for begin()
keyboard.begin(data_pin, irq_pin);
Valid irq pins:
/*
Connections:
CLOCK: Pin 2 (interrupt 0)
LOAD: Pin 3 (interrupt 1)
DATA IN: Pin 4
This sketch emulates the SPI interface of the
MAX7219 chip and constantly prints the values
of the internal 16 registers to the serial
@jboecker
jboecker / WitchcraftServerEnv.lua
Created February 26, 2015 16:49
DCS Witchcraft adapted to the DCS "server" Lua environment (e.g. by commenting out env.info() calls)
--[[
Setup of on_process() function taken from the excellent example set by SLMod
]] --
log("Loading Witchcraft into the server environment...")
witchcraft = witchcraft or {}
witchcraft.oldfunc = {}
witchcraft.oldfunc.on_process = server.on_process()
#!/usr/bin/env python3
"""
Python3 script to manage an external Lenovo LT1423p monitor
Requirements: xrandr, wmctrl, displaylink service
"""
LAPTOP_WACOM_DEVICES=[
"Wacom Serial Penabled 1FG Touchscreen stylus",
"Wacom Serial Penabled 1FG Touchscreen eraser"
]
local witchcraft = {}
witchcraft.host = "localhost"
witchcraft.port = 3401
local require = require
local loadfile = loadfile
package.path = package.path..";.\\LuaSocket\\?.lua"
package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
local JSON = loadfile("Scripts\\JSON.lua")()
@jboecker
jboecker / MAX7219SegmentId.ino
Created November 25, 2016 18:31
This is a simple example sketch to test a 7-Segment display driven by a MAX7219 chip.
#include "LedControl.h"
// modified LCDemo7Segment example from the LedControl library
/*
pin 2 = DataIn
pin 3 = CLK
pin 4 = LOAD
1 = Anzahl hintereinandergeschalteter MAX7219-Chips
*/
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"
#include "LedControl.h"
LedControl lc=LedControl(2,3,4,1);
void onUv26DisplayChange(char* newValue) {
/* set digit 4 to first character (newValue[0]) */