Skip to content

Instantly share code, notes, and snippets.

View theonewolf's full-sized avatar

Wolfgang Richter theonewolf

View GitHub Profile
@theonewolf
theonewolf / test_move.py
Created November 26, 2013 04:26
example bot with movement memory reset each turn
import rg
from random import seed,randint
class Robot:
def __init__(self):
self.oldturn = -1
seed(None)
def act(self, game):
if game.turn != self.oldturn:
@theonewolf
theonewolf / deduplicator.py
Created November 8, 2013 15:18
Deduplication example for ACM XRDS blog
#!/usr/bin/env python
from sys import argv as args
original = args[1]
index = args[2]
size = int(args[3])
dedup = args[4]
def dedup(index, original, dedup, size):
@theonewolf
theonewolf / Makefile
Last active December 27, 2015 13:59
SOSP'13 Question from Presenter (Xi Wang)
default:
gcc question.c -o question -Wall -Werror
./question
@theonewolf
theonewolf / Makefile
Created September 11, 2013 21:50
GNU make Brain Teaser
default:
true && printf '\t\x1b[32mBuild Succeeded\x1b[0m\n'
true && bash -c "printf '\t\x1b[32mBuild Succeeded\x1b[0m\n'"
printf '\t\x1b[32mBuild Succeeded\x1b[0m\n'
@theonewolf
theonewolf / drawer.py
Last active December 20, 2015 22:48
PIL draw test
#!/usr/bin/env python
from PIL import Image, ImageDraw
im = Image.new("RGB", (1024,1024), "white") # you could also Image.open(...)
drawer = ImageDraw.Draw(im)
# draw connecting line
drawer.line((256,256,512,512), fill=96, width=5)
@theonewolf
theonewolf / test.html
Created August 11, 2013 20:40
minimal changePage() jQuery Mobile example
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<script>
function switcher() {
console.log('entering switcher()')
$.mobile.changePage($("#page2"));
console.log('switcher() just ran');
@theonewolf
theonewolf / Makefile
Last active December 20, 2015 21:59
skeleton Python C++ interface
default:
python setup.py build
ln -fs build/lib.linux-x86_64-2.7/hello.so hello.so
python -c 'import hello; hello.func("it is workingses!")'
test_hello:
g++ test_main.cpp \
hello_world.cpp \
-o test_main
@theonewolf
theonewolf / skeleton.py
Created August 9, 2013 14:34
Flask app for CMU SAMS Project 2 in Cyber Security
#!/usr/bin/env python
import json
import subprocess
import tempfile
from flask import Flask, url_for, redirect, render_template, request
from os import fdopen,remove
app = Flask(__name__)
@theonewolf
theonewolf / graph.py
Created August 7, 2013 15:58
Dijkstra's Recipe in Python Example (shamelessly stolen; links embedded)
#!/usr/bin/env python
graph = {
'N1': {'N2': 1},
'N12':{'N13':1},
'N2': {'N4': 1, 'N13':1},
'N4': {'N5': 1, 'N12': 1},
'N5': {'N6': 1},
'N6': {'N7': 1},
@theonewolf
theonewolf / test.md
Created June 12, 2013 16:05
example markdown gist

Here is regular text. Now for some Ruby:

require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html