Skip to content

Instantly share code, notes, and snippets.

Gabrii gabrii

Block or report user

Report or block gabrii

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gabrii
gabrii / FOO
Last active Mar 21, 2017
Pseudo random number & series generator, consistent across python 2.x and 3.x based on SHA
View FOO
11
# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD# HELLO WORLD
@gabrii
gabrii / symbolencoder.py
Created May 2, 2015
Algorithm to encode any text in the optimal chemical symbols representation. Full article at http://gabgav.com/writing-with-elements/
View symbolencoder.py
# import elements database
from periodic import elements
# Exclude last 6 new elements, which have 3 letters provisional names
# And parse everything into a tuples array
elements = [(element.symbol, element.name) for element in elements[:-6]]
def print_elements(elements_array):
"""Prints an array of elements with brackets, and prints fake elements as normal text"""
View wv.py
from bs4 import BeautifulSoup
s = '''STRING CON TODO EL HTML CONTENIDO EN LA ETIQUETA <div class="message-list"...> de http://web.whatsapp.com/'''
s = BeautifulSoup(s)
s = s.findAll('div', {'class':'bubble bubble-text'})
votes = {}
for l in s:
try:
View whatsapp votes
from bs4 import BeautifulSoup
s = '''STRING CON TODO EL HTML CONTENIDO EN LA ETIQUETA <div class="message-list"...> DE http://web.whatsapp.com/ DEL GRUPO CON TODOS LOS MENSAJES CARGADOS'''
s = BeautifulSoup(s)
s = s.findAll('div', {'class':'bubble bubble-text'})
votes = {}
for l in s:
try:
@gabrii
gabrii / particledope.py
Created Dec 23, 2013
Particles simualtion with Coulomb's Law and cubic gravitational law ( like the normal gravitation law, but with r³ instead of r²). This simulation does not have any phisical meaning, it's just for fun. See some captures at: http://sta.sh/21s1a54ox37m
View particledope.py
#! /usr/bin/env python
'''
Controls:
Adding particles (and it's charges):
left button -> (+)
right button -> (-)
middle button -> ( )
SPACE : Play/pause
View indexer.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sunburnt
import nltk
import urlparse
from StringIO import StringIO
import re
from color import *
import threading
import time
@gabrii
gabrii / format_number.py
Created Oct 29, 2013
Pyhton number formating
View format_number.py
# Original code from: http://stackoverflow.com/questions/5807952/removing-trailing-zeros-in-python
import decimal
import random
def format_number(num):
try:
dec = decimal.Decimal(num)
except:
return 'bad'
tup = dec.as_tuple()
@gabrii
gabrii / re_email.py
Created Oct 18, 2013
Regular Expression for matching emails.
View re_email.py
re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", email)
@gabrii
gabrii / gh_userchecker.py
Created Sep 22, 2013
Checks github usernames availability of a list of usernames.
View gh_userchecker.py
from httplib2 import Http
# Exemple of usernames list (all combinations of 3 letters from a to z):
from string import letters
letters = letters[:26]
usernames = [ a+b+c for a in letters for b in letters for c in letters]
h = Http()
You can’t perform that action at this time.