Skip to content

Instantly share code, notes, and snippets.

View whyvez's full-sized avatar

Yves Richard whyvez

View GitHub Profile
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 / install-psycopg2.sh
Last active July 13, 2022 02:58
install psycopg2 on aws linux
sudo yum install gcc python27 python27-devel postgresql-devel
sudo curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python27
sudo /usr/bin/easy_install-2.7 pip
sudo pip2.7 install psycopg2
@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],
@whyvez
whyvez / normalize.sql
Created June 6, 2014 02:27
afgo normalize
CREATE OR REPLACE FUNCTION normalize() RETURNS boolean AS $$
DECLARE
a_record_exists boolean;
BEGIN
PERFORM fix_staging_dates();
SELECT 1 INTO a_record_exists
FROM vw_bio_val_normalized
WHERE (OrganizationName || CompanyPlotNumber || TreeNumber || MeasurementNumber || MeasurementYear) IN
(