Skip to content

Instantly share code, notes, and snippets.

View ftorto's full-sized avatar

ftorto ftorto

  • TOULOUSE, France
View GitHub Profile
@ftorto
ftorto / SSHQuickref.md
Last active April 13, 2018 07:19
SSH Quickref

Environment

  • A initialize connection (ie. run ssh command) to B
  • A has a service SA exposed to port 11111
  • B has a service SB exposed to port 22222
  • Connection links between computers is D--A--B--C (each computer can only see immediate neighbors)

Scenarios

SB visible from A via A:10000

@ftorto
ftorto / install .sh
Created April 13, 2018 06:53
Install kodi on raspberry pi B
#Kodi available directly in repo
sudo apt install kodi
# Missing lib when using debian-stretch light
sudo apt-get install libraspberrypi0
@ftorto
ftorto / README.sh
Created March 23, 2018 15:46
Use other mouse buttons in ubuntu
# install deps
sudo apt install xte xbindkeys
# Write default configuration
xbindkeys --defaults > $HOME/.xbindkeysrc
# Detect mouse button code (press desired buttons inside window)
xev -event mouse | grep Button --before-context=1 --after-context=2
# Edit $HOME/.xbindkeysrc
### Keybase proof
I hereby claim:
* I am ftorto on github.
* I am ftorto (https://keybase.io/ftorto) on keybase.
* I have a public key whose fingerprint is 65B4 874C EF93 35AF B7DF D212 15DB C405 801C 44E0
To claim this, I am signing this object:
@ftorto
ftorto / openpgp.txt
Created February 13, 2018 18:43
Identité reliée à OpenKeychain
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:65b4874cef9335afb7dfd21215dbc405801c44e0]
@ftorto
ftorto / README.md
Created February 13, 2018 14:05
Google agenda into thunderbird
@ftorto
ftorto / cleangpg.sh
Created February 12, 2018 21:53
Remove primary secret key from .gnupg
# Your fingerprint
gpgKey=0x1234123123123
# Export the full backup to store somewhere
gpg --export-secret-keys --armor ${gpgKey} > ${gpgKey}.full_backup.asc
# Export partial backup with only your subkeys
gpg --export-secret-subkeys --armor ${gpgKey} > ${gpgKey}.only_subkeys.asc
# Erase your .gnupg
@ftorto
ftorto / remove_block_if_pattern_found.sh
Created November 2, 2017 08:26
Remove a block (like a comment block) if this one contains a defined pattern in a specific file
# Remove a block beginning with $1, ending with $2 if it contains $3, in file $4
# $1 and $2 are sed regexp escaped surrounded with '/'
# Example: remove_block_if_pattern_found '/\/\*/' '/\*\//' '@license' $f
function remove_block_if_pattern_found {
start=$1
end=$2
pattern=$3
file=$4
# Considering everything above "package ...;" as header
@ftorto
ftorto / README.md
Created October 11, 2017 07:31
Parallelize tasks #jenkins #pipeline
  for (i = 0; i < sources.length; i++){
    String source = sources[i]
    String contrib_url = source.split(" ")[0]
    String contrib_tag = source.split(" ")[1]
    String contrib_dest_path = i.toString().padLeft(4,'0') + "__" + contrib_url.split('/').last() + "__" + contrib_tag
    builders[contrib_dest_path] = {
      echo "\u2600 Pulling [${contrib_url}] using tag [${contrib_tag}] to [${contrib_dest_path}]"
      checkout([$class: 'GitSCM', branches: [[name: "refs/tags/"+contrib_tag]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: contrib_dest_path]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: credentials, url: contrib_url]]])
 }

Prints an horizontal line taking the whole terminal length (no auto resize)

printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' _