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 / 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
@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')
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 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\" |
@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 / 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 / .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 / .bash_profile
Last active March 1, 2017 09:03
osx .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 March 1, 2017 09:00
Custom configuration for linux screen tool
# 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 April 8, 2016 09:36
Linux configurations (fedora 21)
! 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