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
# -*- coding: utf-8 -*- | |
import numpy | |
import cvxopt | |
cvxopt.solvers.options['show_progress'] = False | |
class SVMClassifier(object): |
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
""" | |
Corpus preprocessing script | |
Usage: | |
preprocess.py | |
preprocess.py [<modulo> <modulo_result>] [options] | |
preprocess.py --increment-ner | |
preprocess.py -h | --help | --version | |
Options: |
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 [ -z "$1" ] || [ -z "$2" ]; then | |
echo "Usage: scancan.sh <number of scans> <preparation time>" | |
exit | |
fi | |
echo "Waiting $2" | |
sleep $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
# -*- coding: utf-8 -*- | |
import markovify | |
import codecs | |
# Get raw text as string. | |
with codecs.open("corpus.txt", encoding="utf-8") as f: | |
text = f.read() | |
# Build the model. |
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 | |
# -*- encoding: utf-8 -*- | |
import time | |
import random | |
import sys | |
if len(sys.argv) > 1: | |
word = " ".join(sys.argv[1:]) | |
else: |
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 | |
import sys | |
import time | |
def f(k): | |
return lambda j: (j <= k) or (j%k != 0) | |
def criba(i, version=1): | |
p = range(2, i) |
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 | |
# encoding: utf-8 | |
import os | |
import sys | |
import fcntl | |
import struct | |
import termios | |
import threading | |
from time import sleep |
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: utf-8 | |
""" | |
Shows how to add a method to a instance of an object. | |
""" | |
class Useless: | |
""" | |
Does nothing, unless you hack it. |
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 | |
IMGPATH="/tmp/$(date +%s)_imgur.png" | |
if [ "$1" = "window" ]; then | |
scrot --focused "$IMGPATH" | |
else | |
scrot "$IMGPATH" | |
fi |
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: utf-8 | |
""" | |
Checkout queue test, a test between two models of queues on supermarkets | |
and banks and stuff like that. | |
The two models tested are: | |
Independent checkouts Single queue |
OlderNewer