Skip to content

Instantly share code, notes, and snippets.

View whyvez's full-sized avatar

Yves Richard whyvez

View GitHub Profile
@whyvez
whyvez / cors.txt
Last active August 29, 2015 13:56
cors.txt
from rmwb w/ no compat: (working)
"user-agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
from rmwb w/ compat: ( not working)
"user-agent": "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; BRI/2)"
from spencer w/ compat: (working)
"user-agent": "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; ASU2JS)"
@whyvez
whyvez / index.html
Last active August 29, 2015 13:56
leaflet with two layers
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>A Simple Map</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.1/mapbox.css' rel='stylesheet' />
private void enableHTML5AppCache() {
webView.getSettings().setDomStorageEnabled(true);
// Set cache size to 8 mb by default. should be more than enough
webView.getSettings().setAppCacheMaxSize(1024*1024*8);
// This next one is crazy. It's the DEFAULT location for your app's cache
// But it didn't work for me without this line
webView.getSettings().setAppCachePath("/data/data/"+ getPackageName() +"/cache");
packages:
yum:
gcc-c++: []
make: []
sources:
/home/ec2-user: http://download.redis.io/releases/redis-2.8.4.tar.gz
commands:
redis_build:
command: make
cwd: /home/ec2-user/redis-2.8.4
@whyvez
whyvez / README.md
Last active August 29, 2015 13:57
aws linux mapnik install
@whyvez
whyvez / install-node-mapnik.sh
Last active August 29, 2015 13:58
installs node mapnik
# usage: curl https://[gist-raw-url] | bash
sudo yum -y update;
sudo yum -y upgrade;
sudo yum -y install git nodejs npm postgresql-devel --enablerepo=epel
git clone https://github.com/mapnik/node-mapnik.git
cd node-mapnik
git checkout 1.4.1
@whyvez
whyvez / format_sql.py
Created May 3, 2014 14:44
pipeable util to format sql scripts
#!/usr/local/bin/python
import sys
import sqlparse
# usage cat test.sql | ./format_sql.py > test2.sql
def main(argv):
sql = sys.stdin.read().replace('\n', '')
print sqlparse.format(sql, reindent=True, keyword_case='upper')
@whyvez
whyvez / plpg.sql
Created May 6, 2014 02:26
plpg function block
CREATE FUNCTION stage_files(text) RETURNS text AS $$
DECLARE
path ALIAS FOR $1;
BEGIN
RETURN path;
END;
$$ LANGUAGE plpgsql;
@whyvez
whyvez / install-py27.sh
Created May 14, 2014 13:03
install python 2.7 on Amazon Linux AMI 2014.03
#credits to: http://www.lecloud.net/post/61401763496/install-update-to-python-2-7-and-latest-pip-on-ec2
# install build tools
sudo yum install make automake gcc gcc-c++ kernel-devel git-core -y
# install python 2.7 and change default python symlink
sudo yum install python27-devel -y
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python
@whyvez
whyvez / violation.py
Last active August 29, 2015 14:02
violations dict
violations = {
'VARIABLES': {
'CompanyPlotNumber': [0],
'DisturbanceYear': [3],
'DisturbanceDay': [5],
'DisturbanceNumber': [1],
'DisturbanceComment': [6],
'DisturbanceCode': [2],
'DisturbanceMonth': [4],
'CompoundFKey': [7],