Skip to content

Instantly share code, notes, and snippets.

View categulario's full-sized avatar
🚲
Always remote

Abraham Toriz Cruz categulario

🚲
Always remote
View GitHub Profile
set encoding=utf-8
scriptencoding utf-8
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-scripts/Align'
@categulario
categulario / infinite.py
Created August 16, 2012 16:53
bucle for infinito en python
def inf(i=0, step=1):
#un generador de iteradores infinitos, como el xrange, pero infinito
while True:
yield i
i+=step
for i in inf():
print i
@categulario
categulario / primos_una_linea.py
Created May 23, 2012 00:04
Lista de números primos del 1 al 100 en python (una sola línea)
#Lista de numeros primos entre 1 y 100 en una sola linea
c = [i for i in xrange(2,101) if (i%2!=0 or i==2) and (i%3!=0 or i==3) and (i%5!=0 or i==5) and (i%7!=0 or i==7)]
print c
@categulario
categulario / quicksort_iterativo.py
Created December 9, 2020 03:49
Implementación iterativa (sin recursión) del algoritmo quicksort
import random
def quicksort_iterativo(lista: [int]) -> [int]:
''' Una implementación del mismo algoritmo que conoces y amas, pero sin
utilizar recursión, solo bucles y una pila '''
ordenada = lista[:]
pila = [(0, len(lista) - 1)]
Diagrama Xalapa
44.4,46.7,41.4,65.9,110.8,278,206.1,164.9,255,89.4,58.7,50
15.7,16.6,18.8,21.1,22,21.7,20.7,20.8,20.4,19.3,17.8,16.4
Diagrama Perote
13.3,14.2,11.1,26.2,34.8,74.9,53.3,54.6,110.8,76,24.8,13.8
9.9,10.9,13.3,14.9,15.4,14.7,13.6,13.4,13.4,12,10.7,12.7
Diagrama Paso de ovejas
14.8,10.2,8.6,10.6,32.3,172.6,239,180.5,161.3,61.2,27.8,14.7
21.4,22.2,24.3,26.7,28.2,28.1,26.7,26.9,26.9,25.8,24.2,22.1
Diagrama las Vigas
import json
import requests
import pandas
from pandas.io.json import json_normalize
import geopandas as gpd
import matplotlib.pyplot as plt
url = "https://smn.conagua.gob.mx/tools/PHP/sivea/siveaEsri2/php/temp_genjson.php?per=T3"
resp = requests.get(url)
data = resp.json()
@categulario
categulario / compare_digest.py
Created June 23, 2014 15:15
Validate GitHub signature in python
# validate github signature
import hashlib
import hmac
import json
signature = hmac.new(GITHUB_TOKEN, payload, hashlib.sha1).hexdigest()
# assuming that the 'payload' variable keeps the content sent by github as plain text
# and 'headers' variable keeps the headers sent by GitHub
@categulario
categulario / hello_evil_world.py
Last active August 13, 2020 00:50
The most wicked hello world ever
print(u'\xa1'+[{'foo': i, 'var': ['pez', 'rana', lambda a: (str(a), u'678hHola mundo!nguy')]} for i in ['a' in 'pan']][not True]['var'][2](1)[1][4:15]) #Jaque mate
@categulario
categulario / index.html
Created July 24, 2019 22:27
an example of overriding a css variable using a media query
<!doctype html>
<html>
<head>
<meta charset="utf8" />
<style>
:root {
--thing-color: blue;
}
#cosa {
@categulario
categulario / suma.py
Created June 27, 2019 20:37
Suma 39 y 47
import hashlib
h = hashlib.new('md5')
h.update(b"39")
new = (h.hexdigest() + '+47').encode()
h = hashlib.new('md5')
h.update(new)