This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
chown www-data:www-data /var/www/docs; | |
chmod go+rx -R /var/www/docs; | |
chmod go+rw -R /var/www/builds; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)] | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"an implementation of conways game of life" | |
# File: gol.py | |
# | |
# Project: Conways game of life | |
# Component: | |
# | |
# Authors: Dominic May; | |
# Lord_DeathMatch; | |
# Mause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: LATIN-1 -*- | |
import sys | |
import csv | |
from xml.dom import minidom | |
from unidecode import unidecode | |
from xml.etree import ElementTree | |
from xml.etree.ElementTree import Element, SubElement, Comment | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import types | |
class Pipeline(object): | |
def __init__(self, source): | |
if type(source) == types.FunctionType: | |
self.pipe = source() | |
else: | |
self.pipe = source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decorator(*arguments): | |
# this function recieves arguments passed to the decorator | |
def real_decorator(function): | |
# this function recieves the function we are decorating | |
def wrapper(*args, **kwargs): | |
# this function recieves the arguments intended for the function we are decorating | |
# print(args, kwargs) | |
# print(inspect.getargspec(function)) | |
# print('args', arguments) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
class InheritDict(collections.UserDict): | |
def __init__(self, data, parent=None): | |
for k, v in data.items(): | |
if isinstance(data[k], dict): | |
data[k] = InheritDict(data[k], self) | |
super().__init__(data) |