Skip to content

Instantly share code, notes, and snippets.

View eric-wieser's full-sized avatar

Eric Wieser eric-wieser

View GitHub Profile
@eric-wieser
eric-wieser / readme.md
Created March 18, 2014 11:21
Pip vcvarsall.bat 64-bit python 3.4
template<int N>
std::array<float, N - 1> gradient(const std::array<float, N> &datain, float dx){
std::array<float, N - 1> result;
for (unsigned long i = 0; i < N-1; i++){
result[i] = (datain[i] + datain[i + 1]) / dx;
}
return result;
}
import requests
import ravenclient
import time
import datetime
from bs4 import BeautifulSoup as soup
url = 'https://www.mealbookings.cai.cam.ac.uk/?event=455&date=2015-06-09'
# line below does non-superhall
url = 'https://www.mealbookings.cai.cam.ac.uk/index.php?event=431&date=2015-05-24'
@eric-wieser
eric-wieser / README.md
Last active August 29, 2015 14:27 — forked from anonymous/Legoline.md
Legoline work

Initial concepts

Option A - chain with pin holes

Special parts needed:

  • 57520 - small sprocket (3LU diam)
  • 57519 - large sprocket (5LU diam)
  • 57518 - chain tread (1.5LU pitch)
package lejos.nxt.addon;
import lejos.nxt.I2CPort;
import lejos.nxt.I2CSensor;
public class IRSeekerV2
{
public static enum Mode {
AC, DC
};
@eric-wieser
eric-wieser / fiddle.response.json
Created October 22, 2011 16:26
Physics coursework data
[
{"angle": 5, "pos": [0.08, 2.58], "date": "Thu 6"},
{"angle": 5, "pos": [0.09, 2.40], "date": "Thu 6"},
{"angle": 5, "pos": [0.10, 2.39], "date": "Thu 6"},
{"angle": 5, "pos": [0.10, 2.49], "date": "Thu 6"},
{"angle": 5, "pos": [0.10, 2.54], "date": "Thu 6"},
{"angle": 5, "pos": [0.12, 2.49], "date": "Thu 6"},
{"angle": 5, "pos": [0.12, 2.68], "date": "Thu 6"},
{"angle": 5, "pos": [0.13, 2.62], "date": "Thu 6"},
{"angle": 5, "pos": [0.13, 2.67], "date": "Thu 6"},
@eric-wieser
eric-wieser / alphabet-soup.py
Created January 24, 2012 08:54 — forked from eric-wieser/alphabet-soup.py
One-statement solution for Alphabet Soup
(lambda i, o:
o.write('\n'.join(
'Case #%d: %d' % (n + 1,
(lambda str, target: min(str.count(l) / target.count(l) for l in target))
(i.readline(), 'HACKERCUP')
) for n in xrange(int(i.readline()))
))
)(open('alphabet.in'), open('alphabet.out', 'w'))
@eric-wieser
eric-wieser / alphabet-soup.py
Created January 24, 2012 08:46
One-line solution for Alphabet Soup
inFile = open('alphabet.in')
outFile = open('alphabet.out', 'w')
print >> outFile, '\n'.join(
'Case #%d: %d' % (i + 1,
(lambda s, target: min(s.count(l) / target.count(l) for l in target))
(inFile.readline(), 'HACKERCUP')
) for i in xrange(int(inFile.readline()))
)
@eric-wieser
eric-wieser / alphabet-soup.py
Created January 24, 2012 18:16 — forked from eric-wieser/alphabet-soup.py
One-line solution for Alphabet Soup
inFile = open('alphabet.in')
outFile = open('alphabet.out', 'w')
print >> outFile, '\n'.join(
'Case #%d: %d' % (i + 1,
(lambda s, target: min(s.count(l) / target.count(l) for l in target))
(inFile.readline(), 'HACKERCUP')
) for i in xrange(int(inFile.readline()))
)
@eric-wieser
eric-wieser / alphabet-soup.py
Created January 24, 2012 18:30
119 Character solution to Facebook HackerCup problem 3
t,n='HACKERCUP',input()
for i in range(n):s=raw_input();print'Case #%d: %d'%(i+1,min(s.count(l)/t.count(l) for l in t))