Skip to content

Instantly share code, notes, and snippets.

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

Benjamin Chenebault bench

🏠
Working from home
View GitHub Profile
@bench
bench / update-alternatives-golang.sh
Last active October 31, 2023 09:55
update-alternatives golang
#!/bin/bash
#
# Use the following script using sudo to install multiple golang installations on your debian
# update-alternatives creates, removes, maintains and displays information about the symbolic links comprising the alternatives system
# Usage : sudo ./full_golang_install.sh
#
if [[ $(id -u) -ne 0 ]] ; then echo "This script should be run using sudo or as the root user" ; exit 1 ; fi
## Configuration and init
@bench
bench / java-update-alternatives.md
Created September 7, 2017 08:51
java and javac update-alternatives

update-alternatives maintains symbolic links determining default commands This is a reminder to install java and javac alternatives.

Install alternatives

Install java compiler alternatives

$ sudo update-alternatives --install /usr/bin/javac javac /home/bchenebault/Apps/jdk1.5.0_22/bin/javac 1
$ sudo update-alternatives --install /usr/bin/javac javac /home/bchenebault/Apps/jdk1.6.0_45/bin/javac 2
@bench
bench / gitlab-merge-request.sh
Last active September 1, 2022 04:20
A script to create gitlab MR from a shell
#!/bin/bash
# Check if jq is installed
if ! type "jq" > /dev/null; then
echo please install jq
fi
title="$(git log --oneline | head -1 | cut -f 2- -d ' ')"
source_branch="$(git branch | grep '*' | cut -f 2 -d ' ')"
target_branch=master
@bench
bench / arch_install
Last active October 6, 2020 12:13
arch install with encrypted disk, ext4 partition, no LVM, one swap file, i3 desktop.
# Create a bootable arch key and boot on it
# load your keymap
loadkeys fr
# connect to internet
iwclt
> station wlan0 scan
> station wlan0 connect SSID
@bench
bench / while_for_syntax_bash.sh
Created February 7, 2018 20:50
while and for loop syntax in bash
# While loop
while [ $i -lt 10 ];
do
[...]
done
# C style for loop
for (( c=1; c<=$MAX_VAL; c++ ))
do
[...]
@bench
bench / gitlab-runner-creation.sh
Created April 5, 2019 09:28
Create a docker runner with socket binding
sudo gitlab-runner register --tag-list "docker" --docker-volumes "/var/run/docker.sock:/var/run/docker.sock" \
--url "https://gitlab.mycompany.com/" --registration-token "Y1riedimjQuJ-rBK-SHe" --executor "docker" \
--description "ci1-docker-temp" --docker-image "docker:stable" --docker-privileged
@bench
bench / cleanup.js
Created August 20, 2018 20:31
remove all documents from a mongoDB database
// This method preserves mongo indexes
db.getCollectionNames().forEach(function(collname) {
db[collname].remove({})
})
@bench
bench / condition_syntax_bash.sh
Created February 7, 2018 21:09
conditions syntax in bash
## check the return of a command
if command; then
[...]
fi
## check by string comparison / numerical / file existence / or more
if [[ CHECK ]]; then
[...]
fi
@bench
bench / cloud_acronyms.md
Created May 4, 2018 13:56
Cloud computing acronyms
  • IAAS (infrastructure as a service) : Permet de monter des machines, c'est de la VM, de l'automatisation. On déplacait l'infrastructure.
  • CAAS (container as a service) : Virtualisation non plus par VM mais par containers tel que Docker. Les fournisseurs peuvent fournir des plateformes d'orchestration dont Google Kubernetes ou Docker Swarm. PAAS (platform as a service) : google app engine, amazon S3, etc, ce sont des sevices managés
  • BAAS (backend as a service) : Ce n'est pas un service de cloud mais un concept d'architecture qui fournit l'authentification, la scalabilité automatique, et des services tels que les push notifications pour le développement d'app mobile.
  • FAAS (functions as a service) : La plate-forme qui instancie à la volée une fonction lors d'un appel d'API. On ne paie plus en nombre de machine ou autre mais au nombre d'appels d'API
@bench
bench / .gitconfig
Created May 23, 2018 09:19
My gitconfig file
[user]
name = Benjamin Chenebault
email = benjamin.chenebault@gmail.com
[push]
default = simple
[alias]
cp = cherry-pick
st = status -s
cl = clone
ci = commit