Skip to content

Instantly share code, notes, and snippets.

👾
Invading

Santiago Espinosa Saigesp

👾
Invading
Block or report user

Report or block Saigesp

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
@Saigesp
Saigesp / .block
Last active Oct 19, 2018
D3v4 feverchart with linear regression
View .block
281f92fae4192c4a569fc992d10a9914
@Saigesp
Saigesp / .block
Last active Oct 19, 2018
D3v4 linear calendar
View .block
a0b505c3d0e42cfbdf39b0d2c19ada0c
@Saigesp
Saigesp / .block
Last active Oct 19, 2018
D3v4 Warming stripes
View .block
eda813560c801474904004d6b6b1cc4c
@Saigesp
Saigesp / catcsv.py
Created Sep 23, 2018
Para recortar archivos CSV desde la linea de comandos
View catcsv.py
# -*- coding: utf-8 -*-
import sys
import csv
from collections import deque
from itertools import islice
def skip_last_n(iterator, n=1):
it = iter(iterator)
prev = deque(islice(it, n), n)
@Saigesp
Saigesp / translate_ine_projection.py
Created Sep 19, 2018
Convert between projections epsg:25830 and epsg:4326 used in INE (Instituto Nacional de Estadística, Spain)
View translate_ine_projection.py
# returns latlng
def get_maxmin_latlon_region(region):
lon_max = -180
lon_min = 180
lat_max = -90
lat_min = 90
if region['type'] == 'Polygon':
for polygon in region['coordinates']:
for point in polygon:
@Saigesp
Saigesp / .block
Last active Oct 22, 2018
D3v4 barchart with js classes
View .block
f906ae2bab36f03a59c78e8d669aa68c
View bashrc
# Virtualenv
. /usr/share/virtualenvwrapper/virtualenvwrapper.sh
# . /usr/local/bin/virtualenvwrapper.sh # alterntive place
# Add git branch if its present to PS1
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\] $(parse_git_branch)\[\033[00m\]\$ '
@Saigesp
Saigesp / sublime-keymap.js
Last active Dec 12, 2018
Default (Linux).sublime-keymap
View sublime-keymap.js
[
{ "keys": ["ctrl+alt+b"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["ctrl+alt+p"], "command": "autoprefixer" },
// console.log()
{ "keys": ["ctrl+alt+c", "ctrl+alt+o", "ctrl+alt+n"], "command": "insert_snippet", "args": {"contents": "console.log($0);"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
]
View fix_geojson.py
# -*- coding: UTF-8 -*-
import os, json, time
from area import area
from termcolor import colored
# python3 -c "from fix_geojson import *; fix_geojson('ESP_MAD_adm6.json')"
def fix_geojson(filename):
try:
@Saigesp
Saigesp / GoogleMapsAPI_get_region_name.py
Created Oct 8, 2017
Function to retrieve region name based on administrative level and coordinates.
View GoogleMapsAPI_get_region_name.py
import os, json, time
import requests
from urllib.request import Request, urlopen
from termcolor import colored
debug_msg = True
def get_region_name(lat,lng,region_type):
def adm_parser(regtype):
tr = {
You can’t perform that action at this time.