Skip to content

Instantly share code, notes, and snippets.

View prophile's full-sized avatar

Alistair Lynn prophile

View GitHub Profile
@prophile
prophile / get-suite.sh
Created November 12, 2014 13:32
Get the modernised srcomp suite
#!/bin/bash
GERRIT=https://www.studentrobotics.org/gerrit
function getgit {
PROJECT=$1
URL=$GERRIT/comp/$PROJECT
PATCH=$2
git clone $URL $PROJECT
cd $PROJECT
git fetch $URL $PATCH
@prophile
prophile / update-builtins.py
Created November 20, 2014 19:00
Update standard pages for SR Trac
from xmlrpc.client import ServerProxy as TracAPI
from xmlrpc.client import Fault as TracFault
from urllib.parse import quote
from getpass import getpass
from pathlib import Path
import sys
import time
username = input('SR Username: ')
password = getpass('SR Password: ')
@prophile
prophile / gist:39b6404907475e9e8681
Created January 3, 2015 23:24
Zerg rush build order
7 SpawningPool
10 Extractor
10 Overlord
10 Zergling
11 Queen
13 +1 Drone on gas
16 +1 Drone on gas
16 +1 Drone on gas
18 EvolutionChamber
18 Overlord
@prophile
prophile / calcmatches.py
Last active August 29, 2015 14:14
Calculate the number of matches in a league
from __future__ import print_function, division
import argparse
from datetime import timedelta
from math import ceil, floor
def parse_time(x):
hours, minutes = x.split(':')
return timedelta(hours=int(hours), minutes=int(minutes))
parser = argparse.ArgumentParser(description='Calculate statistics about matches for an SR competition')
@prophile
prophile / equine.pl
Created March 4, 2015 16:08
A Quine, in Perl
String found where operator expected at equine.pl line 1, near "near "near ""
(Do you need to predeclare near?)
Bareword found where operator expected at equine.pl line 1, near ""near "near"
(Missing operator before near?)
String found where operator expected at equine.pl line 1, near "near """
(Do you need to predeclare near?)
Use of ?PATTERN? without explicit operator is deprecated at equine.pl line 2.
Semicolon seems to be missing at equine.pl line 4.
String found where operator expected at equine.pl line 5, near "near "near ""
(Do you need to predeclare near?)
@prophile
prophile / equine.awk
Created March 5, 2015 20:47
Quine in Awk
awk: cmd. line:1: equine.awk
awk: cmd. line:1: ^ syntax error
@prophile
prophile / scheme.py
Last active August 29, 2015 14:19
A quick Scheme implementation in Python, as a programming exercise
from functools import wraps
from collections import namedtuple
from collections.abc import MutableMapping
import string
import operator
import sys
import numbers
class Parser(object):
__slots__ = ('parse',)
alistairlynn$ clang -pipe -### -emit-llvm -c moof.c
clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/trunk 68401)
Target: powerpc-apple-darwin9
clang: warning: not using the clang compiler for the 'ppc' architecture
"/usr/bin/gcc" "-pipe" "-emit-llvm" "-S" "-arch" "ppc" "-o" "moof.o" "-x" "c" "moof.c"
#import <Foundation/Foundation.h>
#import <objc/objc.h>
#import <dlfcn.h>
const char *class_getImageName(Class cls)
{
int ok;
Dl_info info;
if (!cls) return NULL;
<?php
function apply_transform ( $source, $transform, $params )
{
$tokens = token_get_all($source);
$newContent = '';
foreach ($tokens as $token)
{
$newTok = $transform($token, $params);
if (is_string($newTok))