Skip to content

Instantly share code, notes, and snippets.

View j0hn's full-sized avatar

Gonzalo Garcia Berrotaran j0hn

  • Cordoba, Argentina
View GitHub Profile
import os
from functools import lru_cache
import requests
import urllib.parse
from flask import Flask
from flask import request
from flask import flash
from flask import url_for
#!/bin/bash
# Dependencies: imagemagick, i3lock-color-git, scrot
# IMAGE=$(mktemp).png
# scrot $IMAGE
# # convert $IMAGE -level 0%,100%,0.6 -filter Gaussian -resize 30% -define filter:sigma=2.5 -resize 333.33% $IMAGE
# convert -scale 10% -scale 1000% $IMAGE $IMAGE
# i3lock -i $IMAGE
# rm $IMAGE
# github.com/rafi i3status config
# i3status configuration file
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
# Variables
set $mod Mod4
# Colors
set $base00 #101218
set $base01 #1f222d
set $base02 #252936
set $base03 #7780a1
set $base04 #C0C5CE
set $base05 #d1d4e0
@j0hn
j0hn / changobot.py
Created July 22, 2015 14:20
Bot de cadenas de markov
# -*- 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.
#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: scancan.sh <number of scans> <preparation time>"
exit
fi
echo "Waiting $2"
sleep $2
@j0hn
j0hn / preprocess.py
Created March 3, 2015 20:28
Parallel processing on iepy
"""
Corpus preprocessing script
Usage:
preprocess.py
preprocess.py [<modulo> <modulo_result>] [options]
preprocess.py --increment-ner
preprocess.py -h | --help | --version
Options:
@j0hn
j0hn / svm.py
Created August 1, 2014 18:02
s0plete vector machines
# -*- coding: utf-8 -*-
import numpy
import cvxopt
cvxopt.solvers.options['show_progress'] = False
class SVMClassifier(object):
@j0hn
j0hn / game_walk.py
Last active December 11, 2015 17:58
A* algorithm applied to a game map
#!/usr/bin/env python
# coding: utf-8
import math
from simpleai.search import SearchProblem, astar
MAP = """
##############################
# # # #
# #### ######## # #
@j0hn
j0hn / faces.py
Created January 7, 2013 19:09
Face classification using SimpleAI
#!/usr/bin/env python
# coding: utf-8
import os
import math
import random
from PIL import Image
from simpleai.machine_learning import ClassificationProblem, is_attribute, NaiveBayes, precision, KNearestNeighbors
BASE_PATH = os.path.dirname(os.path.abspath(__file__))