Skip to content

Instantly share code, notes, and snippets.

:shipit:
Trying to figure out what I'm doing

D.M. Mause

:shipit:
Trying to figure out what I'm doing
Block or report user

Report or block Mause

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9a8df814777c8bd651053c688048faf4
To whom this may concern,
I would like to begin by saying that I would have liked to submit this appeal much earlier - and had more time to work on it - however, I have been working on group assignments in all the time I've not been in classes, in hope that my work would end up being worth something.
So, I just wanted to quickly and briefly touch on a few things.
Firstly, procrastination. It bears worth mentioning that this is far from a new problem, though it has been a larger problem in recent years. I believe my primary problem is that the way in which I usually procrastinate is my hobby - which itself is very similar to a large part of the coursework I must complete for my degree. Namely, in regards to the programming work I do for my degree, and the tinkering I do as a hobby. It was recommended that I reach out to Curtin Counselling in regards to the Procrastination Workshop I was informed they held every so often - though to my subsequent disappointment, the last one for this year had already run in
@Mause
Mause / gist:8f09062debae85a480d5
Created Jul 15, 2015
Efficient, lazy, iterator, python pairing
View gist:8f09062debae85a480d5
from itertools import chain, tee
def pairs(iterator):
"""
Returns the items in the iterator pairwise, like so;
>>> list(pairs([0, 1, 2]))
[(0, 1), (1, 2)]
"""
@Mause
Mause / gist:d875f1f3c98b875a492a
Created Jun 8, 2015
Simple parametrized test case implementation
View gist:d875f1f3c98b875a492a
import unittest
from functools import wraps
def parametrized_class(klass):
for name, thing in list(vars(klass).items()):
if not hasattr(thing, 'cases'):
continue
cases = thing.cases
View permissions.c
int main() {
system("chown www-data:www-data /var/www/docs;");
system("chmod go+rx -R /var/www/docs");
system("chmod go+rw -R /var/www/builds");
return 0;
}
View permissions.sh
#!/bin/bash
chown www-data:www-data /var/www/docs;
chmod go+rx -R /var/www/docs;
chmod go+rw -R /var/www/builds;
View startswith.c
#include <string.h>
bool startswith(char* poss, char* chunk) {
char* result = strstr(poss, chunk);
return result != NULL && result == poss;
}
View clean_json.py
def clean_json(google_json):
# delete anti-xss junk ")]}'\n" (5 chars);
google_json = google_json[4:]
# pass through result and turn empty elements into nulls
instring = False
inescape = False
lastchar = ''
normal_json = ""
@Mause
Mause / client.py
Created Jun 14, 2014
A as simple as possible example of a ZMQ ROUTER-to-REQ configuration with curve authentication; ironhouse
View client.py
import logging
logging.basicConfig(level=logging.DEBUG)
import zmq
import zmq.auth
def main(recreate):
if recreate:
zmq.auth.create_certificates('.curve', 'client')
View dict_list.py
>>> l = [' key1 ', ' value1 ', ' \tkey2', 'value2\t\n']
>>> l = [s.strip() for s in l]
>>> d = dict(zip(l[::2], [1::2]))
>>> d
{
'key1': 'value1',
'key2': 'value2'
}
View dict_generator.py
>>> l = ['key1', 'value1', 'key2', 'value2']
>>> l = map(str.strip, l)
>>> l = iter(l) # if not already an iterator
>>> d = dict(zip(l, l))
>>> d
{
'key1': 'value1',
'key2': 'value2'
}
You can’t perform that action at this time.