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
@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 / 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)
@categulario
categulario / apicrud.service
Created June 12, 2019 22:45
Ejemplo de una unidad systemd
[Unit]
Description=El servicio de la aplicación flask del curso
After=network.target
[Service]
User=infopata
Group=infopata
WorkingDirectory=/home/infopata/Proyectos/APIRest/
ExecStart=/ruta/hacia/node index.js
Restart=always
@categulario
categulario / organize.py
Created June 12, 2019 16:15
Toma mi archivo de strava y organízalo por mes para subir a nextcloud
#!/usr/bin/env python3
import subprocess
import csv
import os
from datetime import datetime
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
OUT_DIR = os.path.join(BASE_DIR, 'output')
@categulario
categulario / neural.rs
Created February 1, 2019 01:40
Sample rust file
struct Matrix {
contents: Vec<f64>,
filas: usize,
columnas: usize,
}
impl Matrix {
fn new(filas: usize, columnas: usize) {
Matrix {
}
@categulario
categulario / export.py
Created January 9, 2019 16:51
QGis python script that exports all layers to CSV in the given directory
import os
dirname = "/tmp/csv" # adjust this
for vLayer in iface.mapCanvas().layers():
QgsVectorFileWriter.writeAsVectorFormat(
vLayer,
os.path.join(dirname, vLayer.name() + ".csv"),
"utf-8",
vLayer.crs(),
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'