Skip to content

Instantly share code, notes, and snippets.

View miri64's full-sized avatar

Martine Lenders miri64

View GitHub Profile
@miri64
miri64 / schulze.py
Created October 20, 2015 14:31
Simple Schulze Method script
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 Martine Lenders <mail@martine-lenders.eu>
#
# Distributed under terms of the MIT license.
import csv
import sys
APPLICATION = timex_to_str
BOARD ?= native
RIOTBASE ?= $(CURDIR)/../RIOT
QUIET ?= 1
USEMODULE += timex
CFLAGS += -DLOG_LEVEL=LOG_NONE
include $(RIOTBASE)/Makefile.include
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 Martine Lenders <mail@martine-lenders.eu>
#
# Distributed under terms of the MIT license.
import socket
import pexpect
@miri64
miri64 / gist:a2f815d3bbbc5798de28
Last active August 29, 2015 14:20
Minimal netapi thread
#include <errno.h>
#include "msg.h"
#include "net/ng_netapi.h"
void *_event_loop(void *args)
{
msg_t msg, reply;
reply.type = NG_NETAPI_MSG_TYPE_ACK; /* Prepare reply type */
while (1) {
@miri64
miri64 / shuffle_fate.py
Created December 16, 2014 00:43
Script that randomly pairs up members of the argv list (created to pair up Concept Aspects in the Fate RPG)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright ©2014 Martine Lenders <mail@martine-lenders.eu>
#
# Distributed under terms of the MIT license.
from __future__ import print_function
@miri64
miri64 / gist:cf748f9525d8a3cfa34e
Created June 11, 2014 08:04
RIOT micropython vision
import RIOT.thread as thread
import RIOT.msg as msg
import RIOT.drivers.periph.gpio as gpio
class ReceiveThread(thread.Thread):
def run():
while True:
m = msg.receive()
print "Received message: {:s}".format(m.content)
@miri64
miri64 / posix_header.md
Last active December 24, 2015 07:29
Posix header to implement.
  • aio.h
  • arpa/inet.h [*]
  • assert.h [+]
  • complex.h
  • cpio.h
  • dirent.h [+]
  • dlfcn.h
  • fcntl.h
  • fenv.h
  • fmtmsg.h
class Ball extends Throwable {}
class P {
P target;
P(P target) {
this.target = target;
}
void aim(Ball ball) {
@miri64
miri64 / wake-ws.sh
Created October 1, 2012 13:00
Wake script for spline workstations
#!/bin/bash
if [[ "$#" -ne 1 ]]; then
echo "Usage: $0 <host>" 1>&2
exit 1
fi
HOST="$1"
declare -A HOSTS
@miri64
miri64 / pacicron.sh
Created February 1, 2012 16:38 — forked from slomo/pacicron.sh
apticron for arch
#!/bin/bash
# copy this file to /usr/local/sbin (or any other $PATH location)
# add to daily.cron
# ensure exits
VAR_FILE="/var/lib/pacicron/sha"
MAIL_TO="root"
HOST=$(uname -n)
PKGMGR=$(which yaourt || which pacman)
AURFLAG=$(which yaourt &> /dev/null && echo -en "a")