Skip to content

Instantly share code, notes, and snippets.

@kamotos
Last active May 15, 2021 11:15
Show Gist options
  • Save kamotos/9257821 to your computer and use it in GitHub Desktop.
Save kamotos/9257821 to your computer and use it in GitHub Desktop.
.dotfiles
if [ -f /etc/bash_completion.d/docker.io ]; then
source /etc/bash_completion.d/docker.io
fi
# python
# cdp <python module name> to get in the directory where the module is defined. This work:
# Seen here https://github.com/njharman/dotfiles/blob/master/.bashrc#L44
cdp () {
cd "$(python -c "import os.path as _, ${1}; \
print(_.dirname(_.realpath(${1}.__file__[:-1])))"
)"
}
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
#https://github.com/rupa/z
source ~/z.sh
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
set tabstop=4 " The width of a TAB is set to 4.
" Still it is a \t. It is just that
" Vim will interpret it to be having
" a width of 4.
set shiftwidth=4 " Indents will have a width of 4
set softtabstop=4 " Sets the number of columns for a TAB
set expandtab " Expand TABs to spaces
plugins=(git aws sudo zsh-autosuggestions)
source ~/z.sh
export YDIFF_OPTIONS="-s -w 0 --wrap"
alias yd=ydiff
eval "$(direnv hook zsh)"
# Font configuration (changes require restart)
font:
# The size to use.
size: 10
# The normal (roman) font face to use.
normal:
family: JetBrains Mono
# Style can be specified to pick a specific face.
style: Regular
# The bold font face
bold:
family: JetBrains Mono
# Style can be specified to pick a specific face.
style: Bold
# The italic font face
italic:
family: JetBrains Mono
# Style can be specified to pick a specific face.
style: Italic
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
#font pango:DejaVu Serif 8
font pango:JetBrains Mono 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
#bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Return exec alacritty
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
bindsym $mod+Tab exec ~/.local/bin/rofi.sh
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the window’s width.
# Pressing right will grow the window’s width.
# Pressing up will shrink the window’s height.
# Pressing down will grow the window’s height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
#bindsym $mod+l exec i3lock-fancy
#increase sound volume
indsym XF86AudioRaiseVolume exec --no-startup-id "pacmd list-sinks | grep 'index:' | cut -b12- | xargs -I _ pactl set-sink-volume _ +5%"
#decrease sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id "pacmd list-sinks | grep 'index:' | cut -b12- | xargs -I _ pactl set-sink-volume _ -5%"
# mute sound
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle
# Media player controls
bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# Sreen brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
status_command i3status
tray_output primary
}
exec --no-startup-id rescuetime
exec --no-startup-id megasync
workspace_auto_back_and_forth yes
# suspend
bindcode 150 exec systemctl suspend
docker-compose
# project boilerplate
Cookiecutter
# Django tools
dj-cmd # see https://github.com/nigma/dj-cmd
ipython # see https://github.com/nigma/dj-cmd
ptpython # https://github.com/jonathanslenders/ptpython
# virtualenv
virtualenv
virtualenvwrapper
percol # interactive grep
ohmu # View space usage in your terminal
see # An alternative to Python’s dir function.
# HTTP
httpie # HTTP for humans
http-prompt # HTTPie + prompt_toolkit = an interactive command-line HTTP client
httpstat # Network drilldown
rofi -show combi -combi-modi window,drun,run -modi combi
set -eux
sudo apt-get update
sudo apt-get install -y \
vim
# git
git \
git-flow \
curl \
git-extras \ # https://github.com/tj/git-extras
python-gpgme \ # Dropbox dependency
tree \ # Shows a directory's tree from the shell.
direnv \
htop \ # interactive process viewer
gettext \ # for translation
nodejs \
# Python dependencies
python-pip \
python3-pip \
pylint \
python-dev \
## Pillow dependency
libjpeg-dev \
zlib1g-dev \
## lxml dependency
libxml2-dev \
libxslt1-dev \
# Cpython
libffi-dev \
# iostat alternative
dstat \
iotop \
easytag # MP3 songs tagging
# bat
cd /tmp
wget https://github.com/sharkdp/bat/releases/download/v0.12.1/bat_0.12.1_amd64.deb
-O /tmp/bat.deb
sudo dpkg -i /tmp/bat.deb
# git-flow-completion
sudo wget https://raw.githubusercontent.com/bobthecow/git-flow-completion/master/git-flow-completion.bash -O /etc/bash_completion.d/git-flow-completion.bash
# Caches pip packages downloads
printf '[global]\ndownload_cache = ~/.cache/pip\n' >> ~/.pip/pip.conf
# Security
curl -sfO https://raw.githubusercontent.com/marshyski/quick-secure/master/quick-secure && bash quick-secure
# .gitexcludes
# https://coderwall.com/p/ithnoq/gitexcludes?p=7&q=
cp .gitexcludes ~/.gitexcludes
git config --global core.excludesfile ~/.gitexcludes
# Vagrant
if ! [ `builtin type -p vagrant` ]; then
sudo wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb | sudo dpkg -i
## Vagrant autocomplete
wget https://raw.github.com/kura/vagrant-bash-completion/master/etc/bash_completion.d/vagrant -O /etc/bash_completion.d/vagrant
fi
# Docker
if ! [ `builtin type -p docker` ]; then
sudo apt-get install -y linux-image-generic-lts-trusty
sudo wget -qO- https://get.docker.com/ | sh
# using Docker as a non-root user
sudo usermod -aG docker $USER
fi
# docker-machine
if ! [ `builtin type -p docker-machine` ]; then
curl -L https://github.com/docker/machine/releases/download/v0.8.2/docker-machine-`uname -s`-`uname -m` > /usr/local/bin/docker-machine
chmod +x /usr/local/bin/docker-machine
fi
# Installing Python utils
# Installing docker-compose
sudo pip3 install -r requirements.txt
# docker-compose autocomplete
cd /etc/bash_completion.d/ && sudo wget https://raw.githubusercontent.com/docker/compose/$(docker-compose --version | awk 'NR==1{print $NF}')/contrib/completion/bash/docker-compose
# docker-machine 0.5.0
curl -L https://github.com/docker/machine/releases/download/v0.5.0/docker-machine_linux-amd64.zip >machine.zip && \
unzip machine.zip && \
rm machine.zip && \
mv docker-machine* /usr/local/bin
# Docker tools
## Docker tools - dive
DIVE_VERSION=0.8.1
wget https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.deb \
-O /tmp/dive.deb
sudo dpkg -i ./dive.deb
## Docker tools - dry
curl -sSf https://moncho.github.io/dry/dryup.sh | sudo sh
sudo chmod 755 /usr/local/bin/dry
# Docker tools - lazydocker
go get github.com/jesseduffield/lazydocker
# z
# See https://github.com/rupa/z
if ! [ `builtin type -p z` ]; then
wget https://raw.githubusercontent.com/rupa/z/master/z.sh -P ~
echo "source ~/z.sh" >> ~/.bashrc
fi
# pretty pinging
# Usage : prettyping 8.8.8.8
sudo wget https://raw.githubusercontent.com/denilsonsa/prettyping/master/prettyping -P /usr/bin/
sudo chmod +x /usr/bin/prettyping
# Javascript tootls
sudo apt-get install -y nodejs
# npm
curl -L https://www.npmjs.com/install.sh | sh
# tldr: Simplified and community-driven man pages, https://github.com/raylee/tldr.
sudo curl -o /usr/bin/tldr https://raw.githubusercontent.com/raylee/tldr/master/tldr && sudo chmod +x /usr/bin/tldr
sudo apt-get install -y zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# Adds numbered shortcuts to the output git status https://github.com/ndbroadbent/scm_breeze
git clone git://github.com/ndbroadbent/scm_breeze.git ~/.scm_breeze
~/.scm_breeze/install.sh
source ~/.zshrc # or source ~/.bashrc
mkdir -p ~/.zsh/completion
# docker autocomplete
curl -L https://raw.githubusercontent.com/docker/docker/v`docker version -f "{{.Client.Version}}"`/contrib/completion/zsh/_docker > ~/.zsh/completion/_docker
# docker-compose autocomplete
curl -L https://raw.githubusercontent.com/docker/compose/`docker-compose version --short`/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose
# docker-machine autocomplete - Didn't work last time it was tried. Should check.
curl -L https://raw.githubusercontent.com/docker/machine/v$(docker-machine --version | tr -ds ',' ' ' | awk 'NR==1{print $(3)}')/contrib/completion/zsh/_docker-machine > ~/.zsh/completion/_docker-machine
echo 'fpath=(~/.zsh/completion $fpath)' >> ~/.zshrc
autoload -Uz compinit && compinit -i
# git flow z.sh completion
curl -L https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/plugins/git-flow/git-flow.plugin.zsh > ~/.zsh/git-flow.plugin.zsh
# Pretty JSON
wget -O $HOME/.local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
chmod +x $HOME/.local/bin/jq
wget -O $HOME/bin/broot https://dystroy.org/broot/download/x86_64-linux/broot
chmod +x $HOME/bin/broot
# nix
curl -L https://nixos.org/nix/install | sh
cargo install du-dust
cargo install bandwhich
cargo install sd
# https://github.com/sharkdp/fd
nix-env -i fd
# btm
nix-env -i bottom
# ps
nix-env -i procs
go get -u github.com/cheat/cheat/cmd/cheat
# ls alternative
nix-env -i exa
go install github.com/twpayne/chezmoi@latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment