Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Patrick Ferreira optyler

🏠
Working from home
  • Avignon, France
View GitHub Profile
View RomanToArabic.groovy
class RomanConverter {
final static def VALUES = [
'I': 1,
'V': 5,
'X': 10,
'L': 50,
'C': 100,
'D': 500,
'M': 1000
];
@optyler
optyler / main.js
Created Dec 18, 2018
generate-folder-list-from-anr created by optyler - https://repl.it/@optyler/generate-folder-list-from-anr
View main.js
const IDLIST = 1001701270;
const anr_get_folder_res = {
"response": { "message": "OK" },
"folders": [
{ "_id": { "$id": "5ac746ea98a7677f52cc4f99" }, "title": "VEILLE TARIFAIRE", "query": "(((=assurance | =assurances | =assureur | =assureurs | bancassurance ) (=habitation | =automobile | =automobiles| =auto|=IARD | =MRH | =sant\u00e9 | =dommage | =dommages)) NEAR\/10 ((=prix | =cotisation | =cotisations |=tarif | =tarifs|=prime | =primes | =contrat | =contrats |=co\u00fbt | =co\u00fbts) (augmentation| hausse | baisse | majoration | =segmentation | diminution | \u00e9volution))) | ((mutuelle) NEAR\/10 ((=prix | =cotisation | =cotisations |=tarif | =tarifs|=prime | =primes | =contrat | =contrats |=co\u00fbt | =co\u00fbts) (augmentation| hausse | baisse | majoration | =segmentation | diminution | \u00e9volution)))", "partners_ids": [], "quotes": null, "quotes_expert_mode": false }, { "_id": { "$id": "5acb845498a767a00aecebc6" }, "title": "SATISFACTION CLIENTS", "query": "(=nps | \"net promoter score\" |
@optyler
optyler / merge_vostfr.sh
Created May 31, 2018
merge subtitles and mp4 into mkv.
View merge_vostfr.sh
#!/bin/bash
# DEPENDENCIES
hash ffmpeg 2>/dev/null || { echo >&2 "ffmpeg required but it's not installed. Aborting."; exit 1; }
# CHECK INPUT FILES
if [ -z "$1" ]; then echo "No argument supplied, please add the movie path as first argument"; exit 2; fi
input=$1
filename=$(basename "$input")
@optyler
optyler / send_attachements_one_by_one.command
Created Apr 26, 2017
List and send, one by one, by email pdf and png files matched within directory where the script is located
View send_attachements_one_by_one.command
#!/bin/bash
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd "${DIR}"
MAILTO="abcd-1234@xyz.go"
find . -type f -depth 1 -iname "*pdf" -o -iname "*png" | while read f
do
ATTACH=$f
@optyler
optyler / .powerlevel9k
Created Mar 1, 2017
OhMyZsh + powerlevel9k
View .powerlevel9k
# iTerm font is SourceCode for powerlevel, size 11
# https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched
#
# iTerm Color theme is Seti
# https://github.com/willmanduffy/seti-iterm
#
POWERLEVEL9K_MODE='awesome-patched'
POWERLEVEL9K_NODE_VERSION_BACKGROUND='28'
POWERLEVEL9K_NODE_VERSION_FOREGROUND='15'
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'
@optyler
optyler / .bash_profile
Last active Mar 1, 2017
osx .bash_profile
View .bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Git tweeks
git_dir_shell=$(brew --prefix)/etc/bash_completion.d
if [ -f $git_dir_shell/git-prompt.sh -a -f $git_dir_shell/git-completion.bash -a -f $git_dir_shell/git-flow-completion.bash ]; then
source $git_dir_shell/git-prompt.sh
source $git_dir_shell/git-completion.bash
source $git_dir_shell/git-flow-completion.bash
@optyler
optyler / .screenrc
Last active Mar 1, 2017
Custom configuration for linux screen tool
View .screenrc
# Turn off that annoying start up message
startup_message off
# Turn the even more annoying whole-screen-flash-on-tab-complete "feature"
vbell off
# Window list at the bottom. hostname, centered tabs and redmarked active windows:
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
@optyler
optyler / .Xdefaults
Created Apr 8, 2016
Linux configurations (fedora 21)
View .Xdefaults
! Defaults for all xterm clients
Xcursor.size: 28
Xcursor.theme: Shere_Khan_X
! XTERM
XTerm*background: #191919
XTerm*foreground: #FED053
XTerm*highlightColor: magenta
XTerm*geometry: 71x21
XTerm*font: xft:Terminus:pixelsize=10:antialias=false
View Intermediaire - Phone numbers - Numéro de téléphone
var N = +readline();
var ROOT = {}; // All tree node with all numbers
var max = 0; // number of new keys in trees
for (let i = 0, CR; i < N; i++) {
CR = ROOT; // Current sub root elements with fragments of numbers, we always starts
var s = readline().split('');
for(let j=0, len=s.length; j < len; j++) {
View fastest - Syracuse suite
var n = readline(); // start number
var t = [n]; // final array with all the values, the first one is the start number
while(n !== 1) {
// if n is even, divide it by 2, else, if it is odd, multiply by 3 and add 1
n = (n%2 === 0) ? (n/2) : 3*n+1;
t.push( n );
}
print(t.join(' '))