Skip to content

Instantly share code, notes, and snippets.

View arnaudcourtecuisse's full-sized avatar
🚀
Starting a new job

Arnaud Courtecuisse arnaudcourtecuisse

🚀
Starting a new job
View GitHub Profile
@arnaudcourtecuisse
arnaudcourtecuisse / squash_n_merge.sh
Created October 21, 2021 10:59
Squash and merge basic implementation
fancy_branch_descr() {
local fancy=${1//[-_]/ }
echo ${fancy^}
}
create_commit_message() {
local base=$1 branch=$2
fancy_branch_descr $branch
git log --pretty=format:"%n* %s" ${base}..${branch}
}
[user]
name = Arnaud Courtecuisse
[alias]
cfg = !code ~/.gitconfig
ignore = "!ignore() { while [ -n \"$1\" ]; do echo $1 >> .gitignore; shift; done }; ignore"
br = branch
d = diff --ignore-all-space
ds = diff --staged
aa = add --all
ap = add --all --patch
@arnaudcourtecuisse
arnaudcourtecuisse / mongo_install.sh
Created June 28, 2018 15:42
Install mongodb repositories and packages
# Install mongodb 3.4 as root
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
apt-get install -y mongodb-org=3.4.0 mongodb-org-server=3.4.0 mongodb-org-shell=3.4.0 mongodb-org-mongos=3.4.0 mongodb-org-tools=3.4.0
systemctl enable mongod
@arnaudcourtecuisse
arnaudcourtecuisse / amqp-get-started.js
Created June 28, 2018 10:13
Basic AMQP producer/consumer implementation using `amqplib`
const amqp = require('amqplib');
const getChannel = async (uri = 'amqp://localhost') => {
const connection = await amqp.connect(uri);
return connection.createChannel();
};
const postMessages = async (channel, queue) => {
await channel.assertQueue(queue);
@arnaudcourtecuisse
arnaudcourtecuisse / npm_bin
Last active June 1, 2018 10:21
Add this in your .bashrc to have your local node_modules/.bin in your path
PROMPT_COMMAND=__prompt_command
__prompt_command() {
# Remove previous existing .bin in $PATH
PATH=$(echo $PATH | sed -e "s@[^:]\+node_modules/.bin@@ ; s/\(^:\|:$\)// ; s/::/:/")
# Add current .bin and export
export PATH=$(npm bin):$PATH
}
@arnaudcourtecuisse
arnaudcourtecuisse / redis.service
Last active June 11, 2018 09:05
Redis install
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
@arnaudcourtecuisse
arnaudcourtecuisse / yarn_completion
Last active June 1, 2018 09:41
Basic yarn bash completion for commands and scripts (place file in /etc/bash_completion.d/)
_yarn() {
local cur prev commands scripts opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
commands="access add autoclean bin cache check config create exec generate-lock-entry global\
help import info init install licenses link list login logout node outdated owner pack publish\
remove run tag team unlink upgrade upgrade-interactive version versions why workspace workspaces"