Skip to content

Instantly share code, notes, and snippets.

View akarzim's full-sized avatar

François VANTOMME akarzim

View GitHub Profile
@akarzim
akarzim / orig-aliases.zsh
Created September 27, 2019 09:01
List and remove *.orig files from the current directory
#
# Aliases
#
# List all *.orig files in the current directory
if (( $+commands[ls] )); then
alias lso='ls -al **/*.orig'
fi
# Remove all *.orig files from the current directory
@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
@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
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
}
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"
}
@akarzim
akarzim / README.md
Last active February 17, 2021 19:18
Docker commands over container partial name

ZSH Docker Aliases

Defines [Docker][1] aliases and functions.

Aliases

Docker

  • dka! Attach to a running container by name
  • dkE! Run an interactive command in a running container by name
@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'
@akarzim
akarzim / exa-aliases.zsh
Created March 20, 2018 16:07
Exa ZSH aliases
alias l='exa -1a' # Lists in one column, hidden files.
alias ll='exa -l' # Lists human readable sizes.
alias lr='ll -R' # Lists human readable sizes, recursively.
alias la='ll -a' # Lists human readable sizes, hidden files.
alias lm='la | "$PAGER"' # Lists human readable sizes, hidden files through pager.
alias lx='ll --sort=Extension' # Lists sorted by extension (GNU only).
alias lk='ll --sort=size -r' # Lists sorted by size, largest last.
alias lt='ll --sort=modified -r' # Lists sorted by date, most recent last.
alias lc='lt -m' # Lists sorted by date, most recent last, shows change time.
alias lu='lt -u' # Lists sorted by date, most recent last, shows access time.
@akarzim
akarzim / README.md
Last active November 20, 2019 10:42
Git additional aliases to Prezto module using ZPlug

Git additional aliases to [Prezto][1] ZSH manager

How to use

With [zplug][2]

zplug "akarzim/7b2f24c7f0dee222b662f35f5bba497a", \
    from:gist, \
    use:git-aliases.zsh, \
 if:"(( $+commands[git] ))"
@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