Skip to content

Instantly share code, notes, and snippets.

View sttts's full-sized avatar

Dr. Stefan Schimanski sttts

View GitHub Profile
@sttts
sttts / gist:3199462
Created July 29, 2012 15:24
_SERVER64 test case
#define _XSERVER64
#include <X11/X.h>
#include <X11/Xproto.h>
#include <xorg/misc.h>
#include <xorg/extnsionst.h>
#include <xorg/dixstruct.h>
int main(int argc, char **argv) {
printf("%d\n", sizeof(Mask));
@sttts
sttts / gist:6756301
Last active December 24, 2015 06:19
Using terminal-notifier the script shows persistent notification center messages for all flagged OmniFocus tasks. Possible, in the notification center preferences one needs to configure the OmniFocus message properly.
tell application id "OFOC"
tell default document
set today to current date
set lstTasks to flattened tasks where ((flagged is true and blocked is false) or (due date is not missing value and due date < today)) and completed is false
repeat with oTask in lstTasks
set theName to name of oTask
set theId to id of oTask
my notify(theName, "", "omnifocus:///task/" & theId, theId)
end repeat
end tell
@sttts
sttts / OmniFocus Selected Task Notification.applescript
Last active December 24, 2015 08:09
Install terminal-notifier by "sudo gem install terminal-notifier". Then put this script to ~/Library/Scripts/Applications/OmniFocus and bind a shortcut like Alt-Cmd-Enter to it using FastScripts. Originally based on Curtis Clifton's "What am I doing" script my largely adapted and extended.
tell application "OmniFocus"
if quick entry of front document is visible then
set theSelectedItems to selected trees of quick entry
else
tell front document
tell (first document window whose index is 1)
set theSelectedItems to selected trees of content
if ((count of theSelectedItems) ≠ 1) then
-- try sidebar selection
set theSelectedItems to selected trees of sidebar
@sttts
sttts / gist:dd8f4472f8b7eb3f9607
Created November 19, 2014 13:35
Application Group in Marathon JSON
{
"id": "/my-app",
"groups": [{
"id": "databases",
"apps": [{
"id": "redis",
"container": {
"type": "DOCKER",
"docker": {
"image": "dockerfile/redis",
@sttts
sttts / gist:15c93690f837c58c9d63
Created November 27, 2014 00:44
Add optional parameters to a Python generator
# Add optional parameters to a decorator.
#
# Usage:
#
# Start with a normal decorator without parameters, e.g.
#
# def decorator(f):
# ...
#
# Add additional parameters with default value and use @optionally_parametrized_decorator, e.g.
@sttts
sttts / gist:ccde0f55fc90ecf435eb
Created January 10, 2015 22:12
Marathon json generator for 3 mongos
var _ = require("underscore/underscore.js");
replicas=3;
seedlist=_.range(replicas)
.map(function(r) {return r+1})
.map(function(r) {return "r" + r + ".tweventy.mongo.service.dc1.consul"})
.join()
console.log(JSON.stringify({
"id": "/mongo",
@sttts
sttts / PieComponent.jsx
Created January 16, 2015 10:28
A React PieChart component without D3
"use strict";
/** @jsx React.DOM */
var React = require("react/addons");
module.exports = React.createClass({displayName: "Pie",
propTypes: {
data : React.PropTypes.array.isRequired,
innerRadius: React.PropTypes.number,
-----BEGIN PGP MESSAGE-----
owF1Un1QVFUUX1ilhREwIEsQpIVKa1vefZ/3Mc4QEmQzNBEgCSHr+7iPfXzswnu7
wA4BJYzgCEj4UTalTWkRWjFGmZoI0kQIQiUjTIOGZiFREDkhtc3YewxN1kz3r3vu
+Z3f/f3OOS2BRoPJJ9U+MXdo30+Ez8AUb9gcGfZypZl3ih5zfKVZKJKRw6XfHFwx
MsebC5GH51RklZ3RDqeIrAVq9BLGYi5Diio7HRoKszJWxlxl0eF6sSQ78pFSosg6
lxlQJEMjBuI0LgBECDzBYCwlIlKgIcIkwEoshQSC0CjtTtX1r1/Ni5w2WdReySQa
JmMpgE1hqeSkRbx7MYFDgcYoiDMizzIEEgSMxBiJ5wDFYTq/DlSRsmRJdblcqi62
GCmFRcimOJ2LjgWXrOcBiTMszQKAaXI41a4bwFkERcBDHEcSoHmIeElEHA4gTUAc
sTggJYqDmAAxHGAQYwmRIAQoMEggSZLDaAmQCNfawCOC5hkgiiLAOUaQKMRINMEB
goroutine 29 [running]:
main.func·005()
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/contrib/mesos/cmd/km/km.go:36 +0x1d2
created by main.main
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/contrib/mesos/cmd/km/km.go:39 +0x34
goroutine 1 [select (no cases), 2 minutes]:
k8s.io/kubernetes/cmd/kubelet/app.(*KubeletServer).Run(0xc208298700, 0xc208298a80, 0x0, 0x0)
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubelet/app/server.go:487 +0x94d
k8s.io/kubernetes/contrib/mesos/pkg/executor/service.(*KubeletExecutorServer).runKubelet(0xc20829c240, 0xc208041d40, 0xc208290230, 0xc208041ce0, 0xc208035110, 0xcd, 0xc20810bf60, 0x0, 0x0)
@sttts
sttts / boot2docker
Last active January 29, 2016 10:19
Simulating enough of boot2docker with docker-machine to build Kubernetes 1.0
#!/bin/bash
case "$1" in
status)
docker-machine status boot2docker | sed 's/Running/running/'
exit ${PIPESTATUS[0]}
;;
shellinit)
docker-machine env boot2docker | egrep -v '^#'
exit ${PIPESTATUS[0]}