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 / function_sample.sh
Created February 7, 2018 20:39
Ecrire une fonction shell
function stdout {
echo "$(date "+%H:%m:%s") $@"
}
@bench
bench / generate_rsa.md
Last active January 16, 2018 15:10
generate private and public rsa keys

First option

$ openssl genrsa -out mykey.pem 1024 # build rsa private key
Generating RSA private key, 1024 bit long modulus
............................................................++++++
....++++++

$ openssl rsa -in mykey.pem -pubout > mykey.pub  # build --BEGIN PUBLIC KEY-- format public key
writing RSA key
@bench
bench / retrieve_project_version_from_pom.sh
Last active November 20, 2017 10:16
retrieve project version from maven pom.xml
#!/bin/bash
mvn help:evaluate -Dexpression=project.version | grep -Ev 'INFO|WARNING'
@bench
bench / trigger-gitlab-job.sh
Last active February 12, 2018 13:30
gitlab multi project pipeline alternative
#!/bin/bash
# downstream, a tool to trigger gitlab CI pipelines
#
# DESCRIPTION
#
# downstream offers a way to trigger a pipeline on a specific branch of one or multiple projects
# Project are identified by their numerical IDs.
# Project IDs can be found under Settings->General->General project settings
# When a branch is not found, it is created from the master and then the pipeline is triggered

Keybase proof

I hereby claim:

  • I am bench on github.
  • I am benchenebault (https://keybase.io/benchenebault) on keybase.
  • I have a public key whose fingerprint is 491D A06E 23F7 CE36 6434 615F EA54 A69B 6EF8 462A

To claim this, I am signing this object:

@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
type PanicFilter struct {
mq.Handler
logger *log.Logger
}
func (f PanicFilter) Handle(d amqp.Delivery) error {
defer func() {
if panic := recover(); panic != nil {
defer d.Nack(false, false) // might have been ACK/NACK already, but for safety.
_, file, line, ok := runtime.Caller(4)
@bench
bench / apt-get.md
Last active November 20, 2017 14:32
dpkg & apt-get cheatsheet

dpkg vs apt-get

dpkg is the acronym for debian package. It's the package management system of Debian and its derivatives.

apt-get means Advanced Packaging Tool. It is a front-end for dpkg that automates installation and configuration.

dpkg commands

A Debian package ".deb" always follows the convention [softname]_[version]_[architecture].deb

@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 / 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