Skip to content

Instantly share code, notes, and snippets.

Guillim guillim

Block or report user

Report or block guillim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dataModel.json
//Ce document est un document de travail avec pour objectif de communiquer sur la structure de la donnée.
//aujourdhui ce qu'on a sur Doccano:
{
"id": 1,
"text": "The Hitchhiker's Guide to the Galaxy (sometimes referred to as HG2G, HHGTTGor H2G2) is a comedy science fiction series created by Douglas Adams. Originally a radio comedy broadcast on BBC Radio 4 in 1978, it was later adapted to other formats, including stage shows, novels, comic books, a 1981 TV series, a 1984 video game, and 2005 feature film.",
"annotations": [{
"label": 1,
"start_offset": 4,
View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@guillim
guillim / flattenObject.js
Created Nov 30, 2018
A simple function to flatten a javascript object
View flattenObject.js
//A simple function to flatten a javascript object, with a '.' delimiter between nested levels
const flatten = (objectOrArray, prefix = '', formatter = (k) => (k)) => {
const nestedFormatter = (k) => ('.' + k)
const nestElement = (prev, value, key) => (
(value && typeof value === 'object')
? { ...prev, ...flatten(value, `${prefix}${formatter(key)}`, nestedFormatter) }
: { ...prev, ...{ [`${prefix}${formatter(key)}`]: value } });
return Array.isArray(objectOrArray)
? objectOrArray.reduce(nestElement, {})
@guillim
guillim / jq-insert-var.sh
Created Jun 11, 2018 — forked from joar/jq-insert-var.sh
Add a field to an object with JQ
View jq-insert-var.sh
# Add field
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
# Override field value
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}'
{
@guillim
guillim / elasticsearch_usefulQueries.es
Last active Jun 13, 2018
Some useful queries for elasticsearch begininer
View elasticsearch_usefulQueries.es
GET _search
GET _cat/indices
#DELETE geographies/zc/uA9Z2mMBzp9LHCxemeE3
#DELETE testindex
GET geographies/_search
GET geographies/zc/wQ9m2mMBzp9LHCxegeG-/
#upadte one document
@guillim
guillim / python_Lambert2gps.py
Created May 30, 2018
convert coordinates from Lambert93 to GPS (WGS84)
View python_Lambert2gps.py
def lambert93toGPS(lambertE, lambertN):
""" Take a Lambert93 point and transform it into GPS format (classic: longitude, latitude)
Keyword arguments:
lambertE -- Lambert coordinates E
lambertN -- Lambert coordinates N
"""
GRS80E= 0.081819191042816
LONG_0= 3
@guillim
guillim / color-scale.js
Created Mar 6, 2018 — forked from mlocati/color-scale.js
Javascript color scale from 0% to 100%, rendering it from red to yellow to green
View color-scale.js
function perc2color(perc) {
var r, g, b = 0;
if(perc < 50) {
r = 255;
g = Math.round(5.1 * perc);
}
else {
g = 255;
r = Math.round(510 - 5.10 * perc);
}
@guillim
guillim / gist:3db3e258a02b1fb69c895b2ee4581a8b
Created Feb 28, 2018 — forked from blemoine/gist:e6045ed93b3d90a52891
Convert Lambert 93 to GPS Coordinates Latitude / Longitude (wgs84)
View gist:3db3e258a02b1fb69c895b2ee4581a8b
Math.tanh = Math.tanh || function(x) {
if(x === Infinity) {
return 1;
} else if(x === -Infinity) {
return -1;
} else {
return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x));
}
};
@guillim
guillim / docker-completion.bash
Created Feb 20, 2018
script to enable docker completion in terminal using 'tab' command
View docker-completion.bash
#!/usr/bin/env bash
# shellcheck disable=SC2016,SC2119,SC2155
#
# Shellcheck ignore list:
# - SC2016: Expressions don't expand in single quotes, use double quotes for that.
# - SC2119: Use foo "$@" if function's $1 should mean script's $1.
# - SC2155: Declare and assign separately to avoid masking return values.
#
# You can find more details for each warning at the following page:
# https://github.com/koalaman/shellcheck/wiki/<SCXXXX>
@guillim
guillim / git-completion.bash
Created Feb 19, 2018
script to enable auto-completion for git commands in your terminal. Add this file at this path: cd ~
View git-completion.bash
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
You can’t perform that action at this time.