Skip to content

Instantly share code, notes, and snippets.

View asdrubalivan's full-sized avatar

Asdrúbal Iván Suárez Rivera asdrubalivan

View GitHub Profile
@asdrubalivan
asdrubalivan / levenshtein.coffee
Created June 7, 2014 16:38
Levenshtein distance algorithm in CoffeeScript
###
# @desc: Recursive Implementation of Levenshtein distance algorithm
# according to Wikipedia's pseudocode implementation of it
# @author: Asdrúbal Suárez (Twitter @asdrubalivan)
###
levenshteinInternal = (s, len_s, t, len_t) ->
if len_s is 0
return len_t
if len_t is 0
return len_s
@asdrubalivan
asdrubalivan / gist:409e2c27a06c05582baa
Created December 14, 2014 14:28 — forked from orlp/gist:8c25ed4abb36372bc6fe
Git refactoring tool
" quick replace occurences
let g:should_inject_replace_occurences = 0
function! MoveToNext()
if g:should_inject_replace_occurences
call feedkeys("n")
call repeat#set("\<Plug>ReplaceOccurences")
endif
let g:should_inject_replace_occurences = 0
endfunction
[general]
fontname=Monospace 10
selchars=-A-Za-z0-9,./?%&#:_
scrollback=1000
bgcolor=#00002b2b3636
bgalpha=65535
fgcolor=#65657b7b8383
disallowbold=false
cursorblinks=false
cursorunderline=false
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=/home/asdrubalivan/.vim/bundle/neobundle.vim/
endif
" Required:
@asdrubalivan
asdrubalivan / tunein_finder.py
Created September 24, 2012 19:26
Tunein's simple parser
# -*- coding: utf-8 -*-
'''
Simple Tunein's Streaming's URL parser
@author: Asdrúbal Suárez
@license: Public Domain
@version: 0.1
@contact: twitter: @asdrubalivan
@usage: tunein_finder.py -url http://tunein.com/radio/EnlaRed-Radio-s89954/ (Don't forget to use the http:// at the beginning)
'''
import argparse
@asdrubalivan
asdrubalivan / russian_romanizer.py
Last active January 2, 2016 08:29
A python script which translates Russian cyrillic into Latin alphabet
# -*- coding: UTF-8 -*-
class Russian_romanizer(object):
cyrillic = {
u'\u0401': u'YO',
u'\u0410': u'a',
u'\u0411': u'B',
u'\u0412': u'V',
u'\u0413': u'G',
u'\u0414': u'D',
@asdrubalivan
asdrubalivan / search_by_user.js
Created July 16, 2019 18:58
Script to search by username using nodebb
const redis = require("redis");
const { promisify } = require("util");
const client = redis.createClient({
db: "5" // Change database as needed
});
const getUserIds = () =>
new Promise((resolve, reject) => {
client.keys("user:*", (err, result) => {
@asdrubalivan
asdrubalivan / convertidor.py
Created November 21, 2012 02:00
Convertidor simple en python
def obtenerDatos():
datos = {}
datos["pies"] = float(raw_input("Valor en pies: "))
datos["metros"] = float(raw_input("Valor en metros: "))
return datos
def metrosAPies(numero):
return numero * 3.2808399
@asdrubalivan
asdrubalivan / MemoryStorageTest.sol
Created July 18, 2022 21:20
Difference between the usage of the keyworks `memory` and `storage` for solidity
pragma solidity ^0.8.0;
contract MemoryStorageTest {
struct StorageStruct {
uint256 value1;
uint256 value2;
}
StorageStruct s;
@asdrubalivan
asdrubalivan / main.py
Created April 23, 2023 20:07
Traslado de estados
import geopandas as gpd
import folium
from shapely.geometry import mapping, Polygon, Point
from shapely.affinity import translate
from shapely.ops import nearest_points
# Read in the shapefile as a GeoDataFrame
PATH = 'PATH' # CAN BE DOWNLOADED https://www.efrainmaps.es/descargas-gratuitas/venezuela/capas-base/
ESTADO = "Trujillo"
gdf = gpd.read_file(PATH)