Skip to content

Instantly share code, notes, and snippets.

View akarzim's full-sized avatar

François VANTOMME akarzim

View GitHub Profile
@akarzim
akarzim / do_backup
Created August 26, 2013 07:46
Just a simple way do perform a daily backup on my external disk.
#!/bin/sh
# Source du backup
SRC="/home/akarzim/Documents"
# Destination du backup
DST="/media/SDBackup"
UUID="/dev/disk/by-uuid/02e610cf-1cda-4891-b6f5-486d216a4d39"
# Date de la forme année-mois-jour-timestamp
# (le timestamp %s sert si on veut faire plusieurs sauvegardes dans la même journée)
DATE=`date +%Y-%m-%d-%s`
@akarzim
akarzim / Logging::Logger.rb
Last active February 2, 2016 08:14
Logging::Logger #with_backtrace
# https://github.com/TwP/logging/
# Temporarily log with or without backtrace
#
# Usage:
# require 'logging'
# logger = Logging.logger(STDOUT)
# logger.with_backtrace do
# logger.error StandardError.new('oups!')
# end
#
@akarzim
akarzim / keybase.md
Created February 13, 2016 15:04
keybase.io verification code

Keybase proof

I hereby claim:

  • I am akarzim on github.
  • I am akarzim (https://keybase.io/akarzim) on keybase.
  • I have a public key ASD_kvOPf8DwAJ3kMZ2viboTc9bqLfdB6gVMqXtsX_aY6wo

To claim this, I am signing this object:

@akarzim
akarzim / README.md
Last active December 18, 2016 11:36
ZSH Docker precmd prompt for Pure theme

Docker precmd prompt for [Pure][1] ZSH theme

How to use

With [zplug][2]

zplug "akarzim/2bd1012f3047585b19cdfad4937895b3", \
    from:gist, \
    on:"sindresorhus/pure", \
 if:"(( $+commands[docker] ))"
@akarzim
akarzim / globalias.zsh
Last active November 1, 2017 17:03
Expand aliases with CTRL+SPACE
#
# Set key binding to extend aliases.
#
# Authors:
# François Vantomme <akarzim@gmail.com>
#
# Return if requirements are not found.
if [[ "$TERM" == 'dumb' ]]; then
return 1
@akarzim
akarzim / ncdu-aliases.zsh
Created August 30, 2018 16:26
NCurses Disk Usage ZSH aliases
# The options are:
# --color dark - use a colour scheme
# -rr - read-only mode (prevents delete and spawn shell)
# --exclude ignore directories I won't do anything about
alias du='ncdu --color dark -rr -x --exclude .git --exclude node_modules'
function brip {
sudo /sbin/route -n add -net 192.168.0.0/16 -gateway $(docker-machine ip)
sudo /sbin/route -n add -net 172.19.0.0/12 -gateway $(docker-machine ip)
interface=$(ifconfig bridge100 | grep member | cut -d ' ' -f 2)
sudo ifconfig bridge100 -hostfilter "$interface"
}
function dkmee {
# Restart manually NFS (why NFS v3?) due to a bug on docker-machine start
docker-machine ssh local -t sudo mount -v -t nfs -o nfsvers=3 $(docker-machine ip):/Users /Users/
# Set config for ES
docker-machine ssh local -t sudo sysctl -w vm.max_map_count=362144
# Update iptables to access container from localhost without expose host port
# https://docs.docker.com/v17.09/engine/userguide/networking/default_network/container-communication/#container-communication-between-hosts
docker-machine ssh local -t sudo iptables -P FORWARD ACCEPT
}
@akarzim
akarzim / ruby-aliases.zsh
Last active July 12, 2019 15:54
Extend Prezto Ruby module aliases
#
# Aliases
#
# Run Rubocop through Bundler
if (( $+commands[bundle] )); then
alias rbbr='bundle exec rubocop'
fi
# Run Middleman through Bundler
@akarzim
akarzim / readme-aliases.zsh
Last active August 12, 2019 12:52
Aliases to access README.md files
#
# Aliases
#
# Edit README.md in Vim
if (( $+commands[vi] )); then
alias vir='vi README.md'
fi
# Show README.md in terminal