Skip to content

Instantly share code, notes, and snippets.

View mickaelandrieu's full-sized avatar
🏠
Working from home

Mickaël Andrieu mickaelandrieu

🏠
Working from home
View GitHub Profile
View template.txt
[Prénom et nom]
[Votre adresse]
[Code postal, Ville]
[Téléphone]
[Adresse e-mail]
[Date]
[Prénom et nom du député]
[Adresse du bureau du député]
[Code postal, Ville du bureau du député]
@mickaelandrieu
mickaelandrieu / install.sh
Last active May 3, 2023 21:40
Install phantomjs/casperjs on GNU/Linux
View install.sh
#!/bin/bash
# `` sudo sh install.sh ``
# Developement environnement
# Important: use 'i686' instead of 'x86_64'
#
# For stable environnement see also : https://gist.github.com/mickaelandrieu/6312724
echo Installation de Phantomjs
cd /usr/local/share
sudo wget https://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-x86_64.tar.bz2
@mickaelandrieu
mickaelandrieu / quotes_json.js
Created November 26, 2013 12:50
Scrap a website with CasperJs, JSON output.
View quotes_json.js
var links = [];
var quotes = [];
var tempUrl = [];
var infos = [];
var maxLinks = 10;
var firstUrl = 'http://www.imdb.com/search/title?at=0&num_votes=5000,&sort=user_rating,desc&start=1&title_type=tv_infoss';
var newUrl;
var x = require('casper').selectXPath;
@mickaelandrieu
mickaelandrieu / index.php
Created August 9, 2018 19:21
Contrôleur frontal standard Symfony 4
View index.php
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;
require __DIR__.'/../vendor/autoload.php';
// The check is to ensure we don't use .env in production
@mickaelandrieu
mickaelandrieu / upgrade_to_symfony3-lts.md
Last active February 8, 2023 20:20
Migration guide to Symfony 3 LTS
View upgrade_to_symfony3-lts.md

Let's migrate a Symfony 2.8 LTS application to Symfony 3 LTS

Handle deprecations

First of all, ensure you don't have any deprecated!

The Symfony documentation explains it well, but let's sum up:

  • install the phpunit bridge ($ composer require --dev symfony/phpunit-bridge)
  • also check all your pages using web profiler and be ensure there is no deprecation error handled
  • found errors and need help about how to fix it ? I did a sort of guide.
View from_shp_to_geojson.py
import geopandas as gdp
dep971 = gdp.read_file('./ZFU/ZFU_Dep971_Scan25_W84.shp')
dep972 = gdp.read_file('./ZFU/ZFU_Dep972_Scan25_W84.shp')
dep973 = gdp.read_file('./ZFU/ZFU_Dep973_Scan25_W84.shp')
dep974 = gdp.read_file('./ZFU/ZFU_Dep974_Scan25_W84.shp')
metropole = gdp.read_file('./ZFU/ZFU_FRM_Scan25_L93.shp')
# convert metropole to lon/lat system
dep971 = dep971.to_crs('EPSG:4326')
View coordinates_transformer.py
from pyproj import Transformer
# EPSG:2154 = Lambert 93 (french projection system)
# EPSG:4326 = WGS 84 (lon/lat)
class CoordinatesEncoder:
def convert(x: float, y: float):
transformer = Transformer.from_crs("EPSG:2154", "EPSG:4326", always_xy=True)
View docker-compose.yml
version: "2"
services:
plex:
image: linuxserver/plex:latest
container_name: plex
environment:
- PUID=1000
- PGID=1000
- VERSION=docker
volumes:
@mickaelandrieu
mickaelandrieu / upgrade2.3-to-2.7.md
Last active April 26, 2022 11:56
Complete migration guide from Symfony 2.3 LTS to Symfony 2.7 LTS
View upgrade2.3-to-2.7.md

From Symfony 2.3 to Symfony 2.7: the complete guide

Objectives

  • assume your code doesn't use any deprecated from versions below Symfony 2.3
  • update dependencies from 2.3 to 2.7
  • do not support "deprecated", be "Symfony3-ready"
  • list tasks component by component, bundle by bundle.
@mickaelandrieu
mickaelandrieu / webservice.js
Created October 11, 2013 20:45
Use casperJs as a Webservice
View webservice.js
/* from http://stackoverflow.com/questions/15852987/casperjs-passing-data-back-to-php/16489950#16489950
//define ip and port to web service
var ip_server = '127.0.0.1:8585';
//includes web server modules
var server = require('webserver').create();
//start web server
var service = server.listen(ip_server, function(request, response) {