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/python | |
import os | |
import logging | |
logging.basicConfig(filename='clean.log', filemode='w', level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(message)s') | |
wd = os.getcwd() | |
alll = os.listdir(wd) | |
files = [] | |
dirs = [] |
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 functools import wraps | |
def logger_without_wrap(fn): | |
def _wrapper(*args, **kwargs): | |
print '# begin: ' + fn.__name__ | |
fn(*args, **kwargs) | |
print '# end: ' + fn.__name__ | |
return _wrapper | |
def logger_with_wrap(fn): |
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 ConfigParser as cp | |
CONFIG_FILE = 'project.conf' | |
_CONF = cp.ConfigParser() | |
_CONF.readfp(open(CONFIG_FILE)) | |
def get(opt, section='DEFAULT'): | |
return _CONF.get(section, opt) |
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 | |
if [[ $# -eq 0 ]]; then | |
echo "Usage:" | |
echo " templater key=value ... inputfile" | |
echo | |
echo "Sample input file:" | |
echo " Hello \${name}, enjoy templater!" | |
echo | |
echo "Sample output:" | |
echo " $ ./templater name=Affo input" |
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
*.log | |
*.aux | |
*.fdb_latexmk | |
*.fls | |
*.toc | |
*.out |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#define N 5 | |
#define MAX 10 | |
int f (int m[][N]) { | |
int a[N * N], cont = 0, in; | |
int i, j, k; |
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 random | |
import time | |
from rx.subjects import Subject | |
#### The System | |
# The entrypoint | |
s = Subject() | |
def produce(word): | |
s.on_next(word) |
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 rx | |
class StatefulOperator(object): | |
def default(self, tup): | |
msg = 'Default method called with ' + str(tup) | |
return dict(message=msg) | |
def __call__(self, tup): | |
method_name = tup.pop('method_name', 'default') | |
return getattr(self, method_name)(tup) |
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 numpy as np | |
import lxmls.readers.simple_sequence as ssr | |
simple = ssr.SimpleSequence() | |
print simple.train, type(simple.train.seq_list) | |
print simple.test, type(simple.test.seq_list) | |
for s in simple.train.seq_list: | |
print s.x, s.y |
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 random | |
import numpy as np | |
# Ok, the point is now to create a naive | |
# bayes model and stop without accounting | |
# for the lab... | |
# We want to model for example the food. | |
# The food can be terrific, bad, not bad, good | |
# or awesome: |
OlderNewer