Skip to content

Instantly share code, notes, and snippets.

@eric-pommereau
eric-pommereau / gist:8132715
Created December 26, 2013 11:40
Simple hack for PHPBB3 --> use email (first part) instead of manual username.
// Edit file includes/ucp/ucp_register.php
$emailParts = explode("@", strtolower(request_var('email', '')));
if(count($emailParts)>1) {
$userName = $emailParts[0] . "-" . substr($emailParts[1], 0,3);
}else {
$userName = utf8_normalize_nfc(request_var('username', '', true));
}
@eric-pommereau
eric-pommereau / gist:9018948
Last active August 29, 2015 13:56
OSM overpass -> getting french "arrondissement" for Paris (see BBox)
<!-- You can use this command line :
wget -O target.osm --post-file=request.osm "http://overpass-api.de/api/interpreter"
where request.osm file contains sample bellow
You can use overpass turbo to design your request
-->
<?xml version="1.0" encoding="UTF-8"?>
<!--This has been generated by the overpass-turbo wizard. The original search was:“boundary=administrative”-->
@eric-pommereau
eric-pommereau / gist:9887637
Created March 31, 2014 08:18
Export mysq table specifying where...
mysqldump --user=root --password=xxx --where="date_time between '2013-01-01' AND '2013-01-10'" db_flight flight_point >export.sql
@eric-pommereau
eric-pommereau / gist:9887701
Created March 31, 2014 08:23
Postgresql : DataFiller
CREATE TABLE usr (
usr_id integer UNIQUE NOT NULL,
usr_ni UNIQUE VARCHAR(20) NOT NULL,
usr_code_unite VARCHAR(20) NOT NULL,
usr_institution CHAR(2) UNIQUE NOT NULL, --df: word=:PN,GN
usr_dthr_create timestamp with time zone NOT NULL,
usr_dthr_update time without time zone DEFAULT now() NOT NULL,
usr_cn VARCHAR(100) NOT NULL,
usr_dept_uid text NOT NULL
);
@eric-pommereau
eric-pommereau / gist:10877685
Created April 16, 2014 13:44
Eclipse content assist under MAC OS (Talend Open Studio)
ctrl+cmd+space
<!-- Les PEI de l'emprise courante-->
<osm-script output="json" timeout="25">
<query type="node">
<has-kv k="emergency" v="fire_hydrant"/>
<bbox-query {{bbox}}/>
</query>
<print mode="meta"/>
</osm-script>
# downloading OSM datas by querying overpass api
wget -O target.osm --post-file=query.osm "http://overpass-api.de/api/interpreter"
# execute an external sql command
mysql -e "delete from db_flight.flight_point WHERE YEAR(date_time) = '2013' and month(date_time)='01';"
# dump a DB and a TABLE, using a filter
mysqldump --where="date_time between '2014-01-01' AND '2014-12-31'" db_flight flight_point | gzip >./2014-export.sql
#import some datas in a spécific DB
mysql -h localhost -uxxxx -pxxxx ati-import < myDumpFile.sql
@eric-pommereau
eric-pommereau / gist:5ff49441cc07051690aa
Last active August 29, 2015 14:05
Useful OSM links
== Download ==
Geofabrik : http://www.geofabrik.de/data/download.html
== Tools ==
- Osm tile calculator : http://tools.geofabrik.de/calc/
- OSM isngpector : http://tools.geofabrik.de/osmi/
- Map Compare : http://tools.geofabrik.de/mc/
# ONLY schemas and only table PATTERN "flight_*" FROM database db_flight INTO dump.txt file
pg_dump -s -t flight_* db_flight >dump.txt