Skip to content

Instantly share code, notes, and snippets.

View jorgeas80's full-sized avatar
🎯
Focusing

Jorge Arévalo jorgeas80

🎯
Focusing
View GitHub Profile
@jorgeas80
jorgeas80 / findfiles.py
Last active August 29, 2015 13:56 — forked from techtonik/findfiles.py
List the full path of all files on a directory filtered by a shell pattern
# Adapted from snippet placed into public domain by
# anatoly techtonik <techtonik@gmail.com>
# http://stackoverflow.com/questions/8151300/ignore-case-in-glob-on-linux
import fnmatch
import os
import re
def findfiles(which, where='.'):
/*
* A function that converts a PostGIS query into a GeoJSON object.
* Copyright (C) 2012 Samuel Giles <sam@sam-giles.co.uk>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
<!DOCTYPE html>
<html>
<head>
<title>Male vs Female expenses | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, div, span, applet, object, iframe,
<!DOCTYPE html>
<html>
<head>
<title>Leaflet example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@jorgeas80
jorgeas80 / index.html
Last active August 29, 2015 14:11
#Hackgriculture map. Shows tweets containing #hackgriculture / hackgriculture and allows clicking on them
<!DOCTYPE html>
<html>
<head>
<title>#Hackgriculture</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.11/themes/css/cartodb.css" />
<style>
html, body, #map {
@jorgeas80
jorgeas80 / odyssey.html
Last active August 29, 2015 14:12
Articulo de Yorokobu CartoDB-ficado
<!doctype><html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Odyssey.js Slides</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="http://cartodb.github.io/odyssey.js/sandbox/favicon.png">
<link rel="icon" type="image/png" href="http://cartodb.github.io/odyssey.js/sandbox/favicon.png">
@jorgeas80
jorgeas80 / validate_password.py
Created February 17, 2015 10:00
Python function to validate a password string
import re
# Taking from https://gist.github.com/psjinx/5722079#file-utils-py
MINIMUM_PASSWORD_LENGTH = 8
REGEX_VALID_PASSWORD = (
## Don't allow any spaces, e.g. '\t', '\n' or whitespace etc.
r'^(?!.*[\s])'
## Check for a digit
'((?=.*[\d])'
## Check for an uppercase letter
@jorgeas80
jorgeas80 / command_line_tricks.md
Last active August 29, 2015 14:27
Nice command line tricks

Show just the commits done to a git branch, when this branch has been already merged into master/develop

git log mybranch --not $(git for-each-ref --format='%(refname)' refs/heads/ | grep -v "refs/heads/mybranch")

Vim automatically adds a newline character at the end of a file, and this causes git diff showing it. We can get rid of this character by doing this

perl -pi -e 'chomp if eof' filename
@jorgeas80
jorgeas80 / configure_postgis_macos
Created March 8, 2012 18:26
PostGIS configure line for Mac OS X 10.6.8
export MACOSX_DEPLOYMENT_TARGET=10.6
export CFLAGS="-Os -arch i386 -arch x86_64"
export PG_CPPFLAGS="-arch i386 -arch x86_64"
export SHLIB_LINK="-arch i386 -arch x86_64"
export LDFLAGS="-arch i386 -arch x86_64"
./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config --mandir=/usr/local/pgsql/share/man/ --with-geosconfig=/Library/Frameworks/GEOS.framework/unix/bin/geos-config --with-projdir=/Library/Frameworks/PROJ.framework/unix --with-gdalconfig=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config
@jorgeas80
jorgeas80 / configure_gdal_macos
Created March 9, 2012 18:12
GDAL configure line for Mac OS X 10.6.8
export MACOSX_DEPLOYMENT_TARGET=10.6
export ARCHFLAGS="-arch i386 -arch x86_64"
./configure --with-threads --disable-static --without-grass --with-jasper=/Library/Frameworks/UnixImageIO.framework/unix --with-libtiff=/Library/Frameworks/UnixImageIO.framework/unix --with-jpeg=/Library/Frameworks/UnixImageIO.framework/unix --with-gif=/Library/Frameworks/UnixImageIO.framework/unix --with-png=/Library/Frameworks/UnixImageIO.framework/unix --with-geotiff=/Library/Frameworks/UnixImageIO.framework/unix --with-sqlite3=/Library/Frameworks/SQLite3.framework/unix --with-odbc --with-pcraster=internal --with-geos=/Library/Frameworks/GEOS.framework/unix -with-static-proj4=/Library/Frameworks/PROJ.framework/unix --with-expat=/usr/local --with-curl --with-python --with-macosx-framework CFLAGS="-Os -arch i386 -arch x86_64" CXXFLAGS="-Os -arch i386 -arch x86_64" LDFLAGS="-arch i386 -arch x86_64"