Skip to content

Instantly share code, notes, and snippets.

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

Patrick Ferreira optyler

🏠
Working from home
View GitHub Profile
@optyler
optyler / .powerlevel9k
Created March 1, 2017 09:11
OhMyZsh + 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 / send_attachements_one_by_one.command
Created April 26, 2017 14:43
List and send, one by one, by email pdf and png files matched within directory where the script is located
#!/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 / merge_vostfr.sh
Created May 31, 2018 15:49
merge subtitles and mp4 into mkv.
#!/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 / main.js
Created December 18, 2018 10:31
generate-folder-list-from-anr created by optyler - https://repl.it/@optyler/generate-folder-list-from-anr
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\" |
class RomanConverter {
final static def VALUES = [
'I': 1,
'V': 5,
'X': 10,
'L': 50,
'C': 100,
'D': 500,
'M': 1000
];
@optyler
optyler / RetreiveTables.groovy
Created September 1, 2022 08:52
get tables names through jdbc connectors
import java.sql.Connection
import java.sql.DatabaseMetaData
import java.sql.DriverManager
def mysql_connection_string = 'jdbc:mysql://toto.com/tata_db'
// If you are on dev you can disable ssl certificate verification
def sqlserver_connection_string = 'jdbc:sqlserver://42.42.42.42:1433;databaseName=tata_db;useSSL=false;integratedSecurity=false;encrypt=true;trustServerCertificate=true'
Connection con = DriverManager.getConnection(sqlserver_connection_string, 'John', 'Doe')
@optyler
optyler / create_thumbnail.sh
Created November 15, 2022 14:38
Create `jpg` thumbnail from `pdf` if file is missing
#!/bin/bash
# requires wkhtmltopdf
for pdf in *pdf; do
filename=$( basename -- "$pdf" )
filename="${filename%.*}"
if [ ! -f "./$filename.jpg" ]
then
convert $pdf $filename.jpg