Skip to content

Instantly share code, notes, and snippets.

View bertbalcaen's full-sized avatar

Bert Balcaen bertbalcaen

View GitHub Profile
@bertbalcaen
bertbalcaen / Convert geometry from an OpenStreetMap Postgress database into GeoJSON
Created January 15, 2015 10:08
Convert geometry from an OpenStreetMap Postgress database into GeoJSON
SELECT ST_AsGeoJSON(ST_Transform(geometry, 4326)), area FROM osm_buildings WHERE id = 1374;
@bertbalcaen
bertbalcaen / gist:9f2731f61f9680e3cc67
Created January 14, 2015 18:24
Convert geometry from an OpenStreetMap Postgress database into latitude/longitude
SELECT name, ST_Y(ST_Transform(geometry, 4326)) AS lat, ST_X(ST_Transform(geometry, 4326)) AS long
FROM osm_places;
@bertbalcaen
bertbalcaen / drupal-translate.sublime-snippet
Created July 14, 2014 18:53
Wrap string in Drupal translate tags
<!--
Where to put this file?
In menu: Sublime Text 2 > Preferences > Browse Packages
Save file as drupal-translate.sublime-snippet, and place in Packages > User.
Key binding:
In menu: Sublime Text 2 > Preferences > Key Bindings - User
Add inside the array:
@bertbalcaen
bertbalcaen / gist:8147752
Last active January 1, 2016 12:59
Search and replace in WordPress db with https://github.com/interconnectit/Search-Replace-DB. Had to change this: --- a/srdb.cli.php +++ b/srdb.cli.php @@ -143,7 +143,8 @@ if ( $missing_arg ) { // new args array $args = array( - 'verbose' => true + 'verbose' => true, + 'dry_run' => false, );
php_with_mysql srdb.cli.php -h localhost -u root -n adaptr -p "" -s "www.adapt-r.eu" -r "adaptr.dev"
php_with_mysql srdb.cli.php -h localhost -u root -n adaptr -p "" -s "adapt-r.eu" -r "adaptr.dev"
@bertbalcaen
bertbalcaen / gist:8027277
Created December 18, 2013 18:26
Convert each page in a PDF to an image.
gs -dNOPAUSE -sDEVICE=jpeg -r600 -sOutputFile=kerstkaart_final%d.jpg -dJPEGQ=100 -q kerstkaart_final.pdf -c quit
@bertbalcaen
bertbalcaen / twitter.csv
Last active December 29, 2015 15:59
Example of a scatterplot created with Processing. You'll need to create a 'data' folder inside the sketch folder and save twitter.csv inside it. Data: Top 100 Twitter users according to number of followers (in 2010?). Based on https://docs.google.com/spreadsheet/ccc?key=0AonYZs4MzlZbdFRwUEJxd1pQYTF0N0VqSENoY1Z6dWc#gid=0.
Username Description Followers Following No of tweets Label
@nytimes News Organisation 3028263 433 60693 ja
@BreakingNews News Organisation 2302858 353 48774 ja
@mashable Media Organisation 2230623 2230 33229 ja
@PerezHilton Blogger 3093601 296 32357 ja
@eonline Media Organisation 2770717 31347 30949 ja
@SouljaBoy Musician 2685282 459 26111 ja
@TIME News Organisation 2413050 165 21033 ja
@ivetesangalo Musician 2205250 234 17753 ja
@MCHammer Musician 2060587 37076 16562 ja
@bertbalcaen
bertbalcaen / form.css
Created August 26, 2013 15:35
CSS to MijnEvent forms to MediaNet Vlaanderen
.wrapper{
padding: 0;
}
#left h3{
display: none;
}
#content img{
display: none;
@bertbalcaen
bertbalcaen / control_brightness_over_serial.ino
Last active December 21, 2015 01:49
Control brightness over serial
int ledPin = 11;
void setup(){
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop(){
while(Serial.available() > 0){
byte val = Serial.read();
@bertbalcaen
bertbalcaen / close_to_the_body.ino
Created August 1, 2013 21:42
Control motors over serial using an Arduino
// 3, 5, 6, 9, 10, and 11
#define MOTOR1 3
#define MOTOR2 5
#define MOTOR3 6
#define MOTOR4 9
#define MOTOR5 10
#define MOTOR6 11
#define MIN_MOTOR_SPEED 40
#define MAX_MOTOR_SPEED 30
@bertbalcaen
bertbalcaen / Extract all frames from a 24 fps movie using ffmpeg
Last active April 6, 2021 09:02
Extract all frames from a 24 fps movie using ffmpeg
ffmpeg -i shame-run.mov -r 24/1 test/output%03d.jpg