This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 math | |
import random | |
# the colorsys module is required for color conversion | |
from colorsys import hsv_to_rgb | |
# the theory for this colour generator was taken from; | |
# http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ | |
def pretty_colours(how_many): | |
"""uses golden ratio to create pleasant/pretty colours |
This file contains hidden or 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 hidden or 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 hidden or 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) |
This file contains hidden or 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
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains hidden or 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 functools import wraps | |
def specific_magic(f): | |
@wraps(f) | |
def wrapper(self, *args, **kwargs): | |
for arg in args: | |
if type(arg) != self.__class__: | |
raise TypeError('{} not of type {}'.format( | |
arg, self.__class__.__name__ |
This file contains hidden or 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
files = { | |
'unique_filename': 'file_data', | |
'unique_filename': ('filename', 'file_data'), | |
'unique_filename': ('filename', 'file_data', 'custom file content type'), | |
'unique_filename': ( | |
'filename', | |
'file_data', | |
'custom file content type', | |
<custom headers in tuple or dict> | |
) |
OlderNewer