Skip to content

Instantly share code, notes, and snippets.

View victorboissiere's full-sized avatar

Victor Boissiere victorboissiere

View GitHub Profile
@victorboissiere
victorboissiere / Dockerfile
Last active August 17, 2020 17:04
Laravel
FROM php:7.2-fpm
# Copy composer.lock and composer.json
COPY composer.lock composer.json /var/www/
# Set working directory
WORKDIR /var/www
# Install dependencies
RUN apt-get update && apt-get install -y \
@victorboissiere
victorboissiere / vs.zsh
Created April 3, 2018 19:21
[MEDIUM] vs with autocomplete
function vs()
{
RESULTS=`find . -type f -not -path '*/\.*' -not -path '*/vendor/*' -not -path '*/packages/*' -ipath "*$1*"`
red() { echo -e "\033[00;31m$1\033[0m"; }
NB_FILES=$(echo $RESULTS | wc -w)
if [ $NB_FILES -eq "1" ]; then
$EDITOR $(echo "$RESULTS" | head -n1 | cut -d " " -f1)
elif [ $NB_FILES -eq "0" ]; then
>&2 red "No matching file"
else
@victorboissiere
victorboissiere / vs.zsh
Created April 2, 2018 14:53
à placer dans .oh-my-zsh/custom
function vs()
{
RESULTS=`find . -type f -not -path '*/\.*' -not -path '*/vendor/*' -not -path '*/packages/*' -ipath "*$1*"`
red() { echo -e "\033[00;31m$1\033[0m"; }
NB_FILES=$(echo $RESULTS | wc -w)
if [ $NB_FILES -eq "1" ]; then
$EDITOR $(echo "$RESULTS" | head -n1 | cut -d " " -f1)
elif [ $NB_FILES -eq "0" ]; then
>&2 red "No matching file"
else
@victorboissiere
victorboissiere / quickfind.sh
Last active April 1, 2018 21:56
Quickly open files matching specific pattern
function vs()
{
RESULTS=`find . -type f -not -path '*/\.*' -iname "*$1*"`
red() { echo -e "\033[00;31m$1\033[0m"; }
NB_FILES=$(echo $RESULTS | wc -w)
if [ $NB_FILES -eq "1" ]; then
$EDITOR $(echo "$RESULTS" | head -n1 | cut -d " " -f1)
elif [ $NB_FILES -eq "0" ]; then
red "No matching file"
else
Role | Name | Upstream | Connection String
----------+---------|----------|---------------------------------------------------------
* master | server1 | | host=server1 user=repmgr dbname=repmgr connect_timeout=2
standby | server2 | server1 | host=server2 user=repmgr dbname=repmgr connect_timeout=2
@victorboissiere
victorboissiere / output
Created March 31, 2018 22:35
Repmgr medium
Role | Name | Upstream | Connection String
----------+---------|----------|---------------------------------------------------------
* master | server2 | | host=server2 user=repmgr dbname=repmgr connect_timeout=2
standby | server1 | server2 | host=server1 user=repmgr dbname=repmgr connect_timeout=2
@victorboissiere
victorboissiere / Vagrantfile
Created March 31, 2018 20:14
Vagrantfile repmgr
Vagrant.configure("2") do |config|
(1..2).each do |n|
config.vm.define "server#{n}" do |define|
define.vm.box = "consumerlab/ubuntu-server-16-04-LTS"
define.ssh.insert_key = false
define.vm.hostname = "server#{n}"
define.vm.network :private_network, ip: "10.0.15.2#{n}"
define.vm.provider "virtualbox" do |node|
node.name = "server#{n}"
@victorboissiere
victorboissiere / .zshrc
Created November 25, 2017 22:57
Replace man with TLDR
function man()
{
OUTPUT="`tldr $1 2>&1`"
if [ $? -eq 0 ]; then
echo $OUTPUT
else
/usr/bin/man $1
fi
}
@victorboissiere
victorboissiere / Basic ssh config
Created December 4, 2016 17:07
Default config for ssh config file
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/github_rsa
AddKeysToAgent yes
exec_always xmodmap -e "clear lock" #disable caps lock switch
exec_always xmodmap -e "keysym Caps_Lock = Escape" #set caps_lock as escape