Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am yacoby on github.
  • I am yacoby (https://keybase.io/yacoby) on keybase.
  • I have a public key whose fingerprint is DEDD E596 12DA FDEA E02F D622 4542 EBC7 7FB7 308B

To claim this, I am signing this object:

def listify(f):
@functools.wraps(f)
def listify_helper(*args, **kwargs):
return list(f(*args, **kwargs))
return listify_helper
#!/usr/bin/env python
# Python 2 and 3 compatible.
#This script takes in a PDF and creates two new PDFs. One has the black and
#white pages and the other has the colour pages. It also takes duplex printing
#into account. So a black and white side which is on the same sheet as a colour
#side will be placed into the colour PDF.
#This is from a script created by Iain Murray. The original comment is below.
#This version simply has some different defaults and removes the PDFtoPPM.
@Yacoby
Yacoby / CompSoc Hoodie
Last active August 29, 2015 13:56 — forked from edran/CompSoc Hoodie
#!/usr/bin/env python
class ExamBoard(object):
def submit(self, work):
work_is_passing_grade = len([work]) > 0
return work_is_passing_grade
class Society(object):
#!/usr/bin/env python
class Society(object):
def __init__(self, name):
self.name = name
self.members = []
def add_member(self, name, matric_number):
#include <iostream>
#include <vector>
#include <functional>
typedef std::function<void(int)> OutputFunction;
typedef std::vector< OutputFunction > OutputFunctionVector;
template<bool c, typename T, typename F>
struct CondT{};
#include <string>
#include <sstream>
#include <boost/preprocessor/iteration/local.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#define YAC_PLUS() +
#define YAC_PLUS_IF(cond) BOOST_PP_IF(cond, YAC_PLUS, BOOST_PP_EMPTY)()
#define YAC_ENUM_TP(count, param) BOOST_PP_REPEAT(count, YAC_ENUM_TP_M, param)
@Yacoby
Yacoby / max_sublist.hs
Last active December 26, 2015 08:59
Get the value of the maximum sublist
maxSublist :: [Integer] -> Integer
maxSublist = fst . foldr (\x (curValue, maxValue) -> (maximum [0, curValue + x], maximum [curValue + x, maxValue])) (0,0)
#! /bin/bash
sleepTime=1;
echo "-------------------------";
echo "------STEP 2-------------";
ipfw -q flush
ipfw add pipe 6000 in > /dev/null
ipfw add pipe 6001 out > /dev/null