Skip to content

Instantly share code, notes, and snippets.

@rmolina
rmolina / EarthEnvDEM90.py
Last active June 20, 2016 12:36
Quick rasterio example on how to sample elevations from the EarthEnv Digital Elevation Model Version 1 by Natalie Robinson and the NCEAS Environment and Organisms (ENO) Working Group, http://www.earthenv.org/DEM
def EarthEnvDEM90(lat, lon):
import rasterio
tile = 'EarthEnv-DEM90_%s%02i%s%03i' % (lat < 0 and "S" or "N",
abs(lat - lat % 5),
lon < 0 and "W" or "E",
abs(lon - lon % 5))
# /vsitar/ allows on the fly decompression of the tiles :)
bil = r'/vsitar/F:\ruben\geodata\dem90\%s.tar.gz\%s.bil' % (tile, tile)
with rasterio.open(bil) as src:
r, c = src.index(lon, lat)
@rmolina
rmolina / autocrack.py
Created October 7, 2015 03:18
Solución automática de crackmes
""" http://rmolina.co/2015/10/solucion-automatica-de-crackmes.html """
import sys
import pexpect
import re
import string
import collections
PIN = './pin-2.14-71313-gcc.4.4.7-linux/pin'
@rmolina
rmolina / ci20-led-and-btn.py
Created June 17, 2015 17:36
Using the onboard led and button on a MIPS® Creator CI20 board
from twisted.internet import reactor
from sysfs.gpio import GPIOController as Controller
from sysfs.gpio import GPIOPinDirection as Direction
from sysfs.gpio import GPIOPinEdge as Edge
Controller().available_pins = [113, 175]
led = Controller().alloc_pin(175, Direction.OUTPUT)
def btn_changed(pin, state): led.value(state)
btn = Controller().alloc_pin(113, Direction.INPUT, btn_changed, Edge.BOTH)
@rmolina
rmolina / PrimeObsession.py
Created April 22, 2015 21:22
PrimeObsession.py
# -*- coding: utf-8 -*-
import requests
import lxml
import sympy
import numpy
def PeopleSetDetail(PeopleSetID, PrimeObsession=False):
site = 'http://comics.www.collectors-society.com/'