Skip to content

Instantly share code, notes, and snippets.

@benoitguigal
benoitguigal / here.py
Created August 6, 2019 06:00
get absolute path of directory
here = path.abspath(path.dirname(__file__))
brew services start tomcat
brew services stop tomcat
@benoitguigal
benoitguigal / textwrap.py
Created July 11, 2019 06:25
Supprime toutes les espaces en de tête de chaque ligne dans text.
textwrap.dedent("""SELECT *
FROM mytable
LIMIT 10""")
@benoitguigal
benoitguigal / autossh.sh
Created July 9, 2019 07:50
permanent ssh tunnel with autossh
autossh -M9042 -N -L 7070:127.0.0.1:7070 airflow@kelrisks-data -i ~/.ssh/id_rsa
@benoitguigal
benoitguigal / transform.sql
Last active June 10, 2019 16:52
Transform coordinates system in PostGIS
# switch from lat/lon to lambert93
st_transform(st_geomfromtext('POINT(0.4705555555555556 46.600000000000)',4326),2154)
SELECT
st_x(st_centroid(st_transform(geog, 4326))),
st_y(st_centroid(st_transform(geog, 4326))),
FROM table
ssh -L 5432:localhost:5432 user@ip
@benoitguigal
benoitguigal / distance.py
Created April 24, 2019 15:28
Calculating distance in geopy
>>> from geopy import distance
>>> paris = (48.8589, 2.3469)
>>> marseille = (43.2804, 5.3806)
# distance between Paris and Marseille using WGS-84
>>> distance.geodesic(paris, marseille, ellipsoid='WGS-84').km
662.8544512165864
# distance between Paris and Marseille using GRS-80
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Person",
"url": "https://benoitguigal.fr",
"mainEntityOfPage": "https://benoitguigal.fr",
"description": "Benoît Guigal – Développeur et Data Engineer",
"birthDate": "1989-02-26",
"image": "https://benoitguigal.fr/assets/image/benoit.png",
"birthPlace": {
@benoitguigal
benoitguigal / index.html
Last active April 14, 2019 10:38
OpenGraph tags
<meta property="og:type" content=website>
<meta property="og:title" content="Benoît Guigal – Développeur et Data Engineer">
<meta property="og:url" content="https://benoitguigal.fr/">
<meta property="og:image" content="https://benoitguigal.fr/assets/images/georgie.png">
<meta property="og:description" content="Benoît Guigal">
@benoitguigal
benoitguigal / index.html
Created April 14, 2019 10:18
HTML meta tags
<meta name="description" content="Benoît Guigal – Développeur et Data Engineer">
<meta name="keywords" content="benoit guigal, resume, blog, skills, experiences, contact">
<meta name="author" content="Benoît Guigal">