Skip to content

Instantly share code, notes, and snippets.

View PeterJCLaw's full-sized avatar

Peter Law PeterJCLaw

  • Marks & Spencer
  • United Kingdom
View GitHub Profile
#!/bin/sh
SROBO_HOME=/home/srobo
_find_sr_remote() {
git remote -v | grep -Em 1 "(srobo|studentrobotics).org/[^~]" | cut -f 1
}
_get_sr_push() {
remote=$(_find_sr_remote)
from sr import *
R = Robot()
print_orientation(orient):
print " rot_x:", orient.rot_x
print " rot_y:", orient.rot_y
print " rot_z:", orient.rot_z
while True:
#!/usr/bin/env python
from collections import defaultdict
from argparse import ArgumentParser
ROOT = "/var/www/html/ide/repos/"
IGNORE_TEAMS = ['SRZ'] + ['SRZ{0}'.format(i) for i in range(2, 5)] + ['100{0}'.format(i) for i in range(4)]
def tidy_source(source):
@PeterJCLaw
PeterJCLaw / abc_matcher.lua
Created July 23, 2014 08:04
File-extension based file matcher for clink
-- starts and ends from http://lua-users.org/wiki/StringRecipes
function string.starts(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
function string.ends(String,End)
return End=='' or string.sub(String,-string.len(End))==End
end
-- helper which filters files by extension
@PeterJCLaw
PeterJCLaw / git-cmds
Created September 21, 2014 17:20
cyanide git commands
$ grep gitExecute.* -o git.php | cut -d ',' -f 2 | sort -u > git-cmds
"add $s_path");
"archive --format=zip $s_commit -".COMPRESSION_LEVEL." > $s_dest");
"checkout $s_path");
"checkout $s_revision");
"checkout $s_rev -- $s_path");
'clean -f -d');
"clone $s_from $s_to");
'clone --shared --quiet'.$s_bare.' '.$s_source.' '. $s_path);
"commit --allow-empty-message -F $s_tmp"
@PeterJCLaw
PeterJCLaw / p1.md
Created October 4, 2014 13:56
preview

To

students

Subject

Something's happening

Body

#!/usr/bin/env python3
from argparse import ArgumentParser
from collections import namedtuple
from datetime import datetime, MINYEAR, tzinfo
import os
from subprocess import check_output
REPO_ROOT = '/var/www/html/ide/repos'
REPO_ROOT = '../repos'
from __future__ import print_function
import datetime
from dateutil.tz import gettz, tzlocal
from freezegun import freeze_time
def show(timezone):
print('-'*20)
print("timezone:", timezone)
tzinfo = SimpleZoneWithDST
short_now 2015-03-07 01:35:00+01:00 datetime.datetime(2015, 3, 7, 1, 35, tzinfo=SimpleZoneWithDST)
long_now 2015-03-07 01:35:00+01:00 datetime.datetime(2015, 3, 7, 1, 35, tzinfo=SimpleZoneWithDST)
start 2014-04-26 12:01:00 datetime.datetime(2014, 4, 26, 12, 1)
stock_repl 2014-04-26 12:01:00+01:00 datetime.datetime(2014, 4, 26, 12, 1, tzinfo=SimpleZoneWithDST)
tz.fromutc 2014-04-26 13:01:00+01:00 datetime.datetime(2014, 4, 26, 13, 1, tzinfo=SimpleZoneWithDST)
fromutc 2014-04-26 13:01:00+01:00 datetime.datetime(2014, 4, 26, 13, 1, tzinfo=SimpleZoneWithDST)
tzinfo = tzlocal()
short_now 2015-03-07 00:35:00+00:00 datetime.datetime(2015, 3, 7, 0, 35, tzinfo=tzlocal())
long_now 2015-03-07 00:35:00+00:00 datetime.datetime(2015, 3, 7, 0, 35, tzinfo=tzlocal())
THINGS TO OCCUR
Thursday (small team of 2-3)
* If seating is out, retract seating
* Mark out layout in Cube & Bar 2
* DJ riser
* Power
* Network
* Verify facilities (projector etc)