Skip to content

Instantly share code, notes, and snippets.

wn@jeltz ~> route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 203 0 0 eno1
130.89.0.0 if-openvpn.rout 255.255.0.0 UG 0 0 0 tap0
130.89.104.0 * 255.255.248.0 U 0 0 0 tap0
130.89.254.224 gateway 255.255.255.224 UG 0 0 0 eno1
192.168.3.0 * 255.255.255.0 U 203 0 0 eno1
wn@jeltz ~> traceroute wiki.student.utwente.nl.
traceroute to wiki.student.utwente.nl. (130.89.163.107), 30 hops max, 60 byte packets
#include <stdio.h>
int main() {
int a = 'abcd';
int b = ((('a')<<24) | (('b')<<16) | (('c')<<8) | ('d'));
printf("%d == %d\n", a, b);
}

It's life, Jim, but not as we know it

You probably know Conway's Game of Life, the famous cellular automaton invented by mathematician John Conway. Life is a set of rules that, together, allow you to simulate a two-dimensional board of cells. The rules decide which cells on the board live and which ones die. With some imagination, you could say that Life is a zero-player game: a game with the objective to find patterns with interesting behavior, like the famous glider.

Glider

A zero-player game... Until today. You are to write a program that plays the Game of Life - and plays it to win, while your opponent's program tries to do the same. The winner is either the last bot standing, or the player with the most live cells after 5 minutes of clock time.

Game rules

@wandernauta
wandernauta / drawmap.c
Last active August 29, 2015 13:57
drawmap.c
i=0;j=0;w=160;f=40;t;b;p;s;e;k;d=86400;q=599;char* m="M('+z EDz :!#\"!*!8S$[\"!$!#\"\")\"!3R)V$'!!()1M./!F)\"!!!!)'/GE5@\"\"!&%.3&,Y$D\"!!%$)5i\"\"\"F\"%&&6%!e'A#!#!!#&$5&!f&A'$*\"5&!c-#'3''8\"$!!#\"U'\"=5$'8#$$\"S(#=7!*5\"!\"#['!A@6#!^H=!#6bH;!!!\"6_!!I;<&!&\"!!$\"F\"!I8;&\"#\"$&#\"C#\"I7<%#!\"/\"BP5=$*,\"=#\"$!L4A%&\"\"G\"\"\"#M1@)*F\"%P/@,!N#!S(E;!@W'E=!!!<Y&D7!&!\"$7\\$D8!)$4_$C8!('&#&!!a&@9!&(%$&g$>9!$*#(%h\">:!!-\"(%&!b!$&5:!\"+\"(!!#$!!!c+5<-!'!'!#!e)5:.!(!&!\"\"e,:25!!!\"!\"\"h-;07#\"$h.9/:\"\"$!!#\"a17-;'!\"$!!\"$!X46,<\"%\"&$\\45,>#&!$$#!W45,C!!!'!\"!$!V26,H\"#!$!\"!\"!S17-#!A!!#\"!_07,\"#A&!\"`.7+#\"A*.!Q.7*$\">/^-9)$\"=0^*<)$!>1]*<(D1])>&E2\\)>&F&!)\\)@#G$%(\\'w%]'x#,\"P%z .\"P%z .!R$z -\"S$z b#z c#z d#z 3";main(){t=(time(0)%d*160)/d;printf("P2\n%d 62\n5\n",w);for(;i<q;i++){for(j=m[i]-' ';j>0;j--){p=k%w,s=(t-f),e=(t+f);printf("%c ", "1324"[b*2+((p>s&&p<e)||(p>s+w&&p<e+w)||(p>s-w&&p<e-w))]);k++;}b=!b;}}
62A99C0E 00000000 2014-34-30T02:34:51 org.teddybear.test.DummyModel|foo=Yea|widgets=10
F869E12F 00000001 2014-34-30T02:34:51 org.teddybear.test.DummyModel|foo=Man|widgets=10
F8D6C5FD 00000002 2014-34-30T02:34:51 org.teddybear.test.OtherDummyModel|bits=20|bobs=30
@wandernauta
wandernauta / pithread.c
Created December 3, 2013 13:12
pithread.c
// Includes
#include <math.h> // for pow
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
// Useful macro's
#define lock pthread_mutex_lock(&job->mutex);
@wandernauta
wandernauta / wander.c
Created November 26, 2013 13:59
Mergesort implementatie
#include "as1_t2.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
// CONFIGURATION.
// Change these to change the type of array msort sorts, or the key it sorts
// on.
@wandernauta
wandernauta / sp
Last active April 16, 2024 15:37
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@wandernauta
wandernauta / gist:6261611
Last active December 21, 2015 06:08
Dent: the phaseless programming language

dent

Dent is a compiled, barely functional, phaseless, statically type-inferred, homoiconic and almost syntaxless programming language. It compiles down to LLVM assembly, which is then optimized and compiled into native binaries. Output binaries are statically linked and stripped.

The primary difference between Dent and other programming languages is that, in Dent, there is no syntactic difference between functions executed at compile time (usually known as macro's in other languages) and functions executed at runtime.

Inspired by: Lisp Smalltalk Haskell Python

Syntax

@wandernauta
wandernauta / cs.xml
Last active December 14, 2015 20:19
My Checkstyle prefs.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: Sun Light
Description:
A lighter version of Sun's coding convention.