├── .config ├── git │ ├── config │ └── ignore ├── nvim │ └── init.vim └── postgres │ └── psqlrc ├── .zshrc ├── README.md ├── base-packages ├── bin ├── git-biggest ├── git-update-committer ├── git-update-email └── git-update-name └── install-arch.sh /.config/git/config: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Jerome Leclanche 3 | email = jerome@leclan.ch 4 | [core] 5 | autocrlf = input 6 | eol = lf 7 | [alias] 8 | change-commits = "!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [[ $`echo $VAR` = \\\"$OLD\\\" ]]; then export $VAR=\\\"$NEW\\\"; fi\" $@; }; f " 9 | clog = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" 10 | fpush = push --force-with-lease 11 | lol = "log --oneline --graph --decorate --all" 12 | merge-pr = "!f() { git fetch $1 $2; git branch _FETCH_HEAD FETCH_HEAD && git rebase HEAD _FETCH_HEAD && git checkout master && git merge --ff-only _FETCH_HEAD; git branch -d _FETCH_HEAD; }; f" 13 | [help] 14 | autocorrect = 1 15 | [pull] 16 | rebase = true 17 | [rebase] 18 | autostash = true 19 | [log] 20 | decorate = full 21 | [stash] 22 | showPatch = true 23 | [push] 24 | followTags = true 25 | [tar "tar.xz"] 26 | command = xz -c 27 | [url "git@github.com"] 28 | insteadOf = github: 29 | -------------------------------------------------------------------------------- /.config/git/ignore: -------------------------------------------------------------------------------- 1 | *.kdev4 2 | __pycache__ 3 | *.pyc 4 | .sass-cache 5 | -------------------------------------------------------------------------------- /.config/nvim/init.vim: -------------------------------------------------------------------------------- 1 | syntax on 2 | 3 | " UI options 4 | set cursorline " Highlight the current line 5 | set number " Enable line numbers 6 | set relativenumber " Hybrid relative line numbers 7 | set showmatch " Show matching brackets 8 | set wildmode=list:longest 9 | set ff=unix " Display DOS line endings 10 | 11 | " Indentation options 12 | set list listchars=tab:»\ ,trail:· 13 | set noexpandtab 14 | set copyindent 15 | set preserveindent 16 | set softtabstop=0 17 | set shiftwidth=4 18 | set tabstop=4 19 | 20 | " Clipboard options 21 | set clipboard+=unnamedplus " Yanks go on clipboard instead 22 | "set paste pastetoggle= 23 | set viminfo='50,<1000,s100,h " Set max buffer size to 1000 lines (default 50) 24 | 25 | " Search options 26 | set ignorecase 27 | set smartcase 28 | " Use to clear the highlighting of hlsearch 29 | nnoremap :nohlsearch=has('diff')?'diffupdate':'' 30 | 31 | " Scrolloff options 32 | set scrolloff=1 33 | set sidescrolloff=5 34 | 35 | set lazyredraw 36 | 37 | " Remove trailing spaces on save 38 | autocmd BufWritePre * :%s/\s\+$//e 39 | 40 | " Alias "write as sudo" as :w!! 41 | cmap w!! w !sudo tee > /dev/null % 42 | 43 | " Plugins 44 | call plug#begin("~/.config/nvim/plugged") 45 | Plug 'jiangmiao/auto-pairs' 46 | Plug 'scrooloose/syntastic' 47 | Plug 'bling/vim-airline' 48 | Plug 'tpope/vim-fugitive' 49 | Plug 'tomtom/tcomment_vim' 50 | Plug 'editorconfig/editorconfig-vim' 51 | Plug 'chriskempson/vim-tomorrow-theme' 52 | Plug 'fatih/vim-go', {'for': 'go'} 53 | Plug 'cespare/vim-toml' 54 | Plug 'hashivim/vim-terraform' 55 | Plug 'ianks/vim-tsx' 56 | Plug 'leafgarland/typescript-vim' 57 | Plug 'peterhoeg/vim-qml' 58 | call plug#end() 59 | 60 | " Silent in case it's not set up yet 61 | silent! colorscheme Tomorrow-Night-Bright 62 | 63 | let g:airline_powerline_fonts = 1 64 | let g:vim_markdown_folding_disabled=1 " Disable markdown folding 65 | let g:syntastic_python_flake8_args = "--ignore=W191,E702 --max-line-length=92" 66 | let g:syntastic_always_populate_loc_list = 1 67 | let g:syntastic_auto_loc_list = 1 68 | if exists('g:loaded_fugitive') 69 | set statusline+=%{fugitive#statusline()} 70 | endif 71 | 72 | " tcomment rebind to `cc` 73 | let g:tcommentMapLeader1 = '' 74 | noremap cc :TComment 75 | vnoremap cc :TCommentMaybeInlinegv 76 | " inoremap cc :TComment 77 | -------------------------------------------------------------------------------- /.config/postgres/psqlrc: -------------------------------------------------------------------------------- 1 | \pset null ¤ 2 | \pset format wrapped 3 | \pset linestyle unicode 4 | \pset border 2 5 | \set HISTFILE ~/.cache/psql_history 6 | \set PROMPT1 '%[%033[33m%]%`date +"[%T]"`% %[%033[31;5m%]%x%[%033[0m%]%[%033[35m%]%n@%m %[%033[37;1m%]%/› %[%033[0m%]' 7 | \set PROMPT2 '%[%033[37;1m%] » %[%033[0m%]' 8 | -------------------------------------------------------------------------------- /.zshrc: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # My .zshrc 3 | # Jerome Leclanche 4 | # https://github.com/jleclanche/dotfiles/blob/master/.zshrc 5 | 6 | 7 | ## 8 | # Somebody set us up the prompt 9 | # 10 | 11 | # Let's have some colors first 12 | autoload -U colors && colors 13 | 14 | if [[ -e /usr/share/zsh/site-contrib/powerline.zsh ]]; then 15 | # Powerline support is enabled if available, otherwise use a regular PS1 16 | . /usr/share/zsh/site-contrib/powerline.zsh 17 | VIRTUAL_ENV_DISABLE_PROMPT=true 18 | else 19 | # Default colors: 20 | # Cyan for users, red for root, magenta for system users 21 | local _time="%{$fg[yellow]%}[%*]" 22 | local _path="%B%{$fg[green]%}%(8~|...|)%7~" 23 | local _usercol 24 | if [[ $EUID -lt 1000 ]]; then 25 | # red for root, magenta for system users 26 | _usercol="%(!.%{$fg[red]%}.%{$fg[magenta]%})" 27 | else 28 | _usercol="$fg[cyan]" 29 | fi 30 | local _user="%{$_usercol%}%n@%M" 31 | local _prompt="%{$fg[white]%}${(r:$SHLVL*2::%#:)}" 32 | 33 | PROMPT="$_time $_user $_path $_prompt%b%f%k " 34 | 35 | RPROMPT='${vcs_info_msg_0_}' # git branch 36 | if [[ ! -z "$SSH_CLIENT" ]]; then 37 | RPROMPT="$RPROMPT ⇄" # ssh icon 38 | fi 39 | fi 40 | 41 | ## 42 | # Environment variables 43 | # 44 | 45 | # basedir defaults, in case they're not already set up. 46 | # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html 47 | if [[ -z "$XDG_DATA_HOME" ]]; then 48 | export XDG_DATA_HOME="$HOME/.local/share" 49 | fi 50 | 51 | if [[ -z "$XDG_CONFIG_HOME" ]]; then 52 | export XDG_CONFIG_HOME="$HOME/.config" 53 | fi 54 | 55 | if [[ -z "$XDG_CACHE_HOME" ]]; then 56 | export XDG_CACHE_HOME="$HOME/.cache" 57 | fi 58 | 59 | if [[ -z "$XDG_DATA_DIRS" ]]; then 60 | export XDG_DATA_DIRS="/usr/local/share:/usr/share" 61 | fi 62 | 63 | if [[ -z "$XDG_CONFIG_DIRS" ]]; then 64 | export XDG_CONFIG_DIRS="/etc/xdg" 65 | else 66 | export XDG_CONFIG_DIRS="/etc/xdg:$XDG_CONFIG_DIRS" 67 | fi 68 | 69 | # add ~/bin to $PATH 70 | path=(~/bin $path) 71 | # add ~/.config/zsh/completion to completion paths 72 | # NOTE: this needs to be a directory with 0755 permissions, otherwise you will 73 | # get "insecure" warnings on shell load! 74 | fpath=("$XDG_CONFIG_HOME/zsh/completion" $fpath) 75 | 76 | 77 | ## 78 | # zsh configuration 79 | # 80 | 81 | # History options 82 | HISTSIZE=10000 # 10k lines loaded in memory 83 | SAVEHIST=100000 # 100k lines saved on disk 84 | HISTFILE="$XDG_CACHE_HOME/zsh_history" 85 | setopt histignorealldups # Substitute commands in the prompt 86 | setopt sharehistory # Share the same history between all shells 87 | 88 | # Other shell options 89 | setopt autocd # assume "cd" when a command is a directory 90 | setopt promptsubst # required for git plugin 91 | # setopt extendedglob 92 | # Extended glob syntax, eg ^ to negate, for range, (foo|bar) etc. 93 | # Backwards-incompatible with bash, so disabled by default. 94 | 95 | # Colors! 96 | 97 | # 256 color mode 98 | export TERM="xterm-256color" 99 | 100 | # Color aliases 101 | if command -V dircolors >/dev/null 2>&1; then 102 | eval "$(dircolors -b)" 103 | # Only alias ls colors if dircolors is installed 104 | alias ls="ls -F --color=auto --group-directories-first" 105 | fi 106 | 107 | alias grep="grep --color=auto" 108 | alias fgrep="fgrep --color=auto" 109 | alias egrep="egrep --color=auto" 110 | # make less accept color codes and re-output them 111 | alias less="less -R" 112 | 113 | 114 | ## 115 | # Completion system 116 | # 117 | 118 | autoload -Uz compinit 119 | compinit 120 | 121 | zstyle ":completion:*" auto-description "specify: %d" 122 | zstyle ":completion:*" completer _complete _correct _approximate 123 | zstyle ":completion:*" format "Completing %d" 124 | zstyle ":completion:*" group-name "" 125 | zstyle ":completion:*" menu select=2 126 | zstyle ":completion:*:default" list-colors ${(s.:.)LS_COLORS} 127 | zstyle ":completion:*" list-colors "" 128 | zstyle ":completion:*" list-prompt %SAt %p: Hit TAB for more, or the character to insert%s 129 | zstyle ":completion:*" matcher-list "" "m:{a-z}={A-Z}" "m:{a-zA-Z}={A-Za-z}" "r:|[._-]=* r:|=* l:|=*" 130 | zstyle ":completion:*" menu select=long 131 | zstyle ":completion:*" select-prompt %SScrolling active: current selection at %p%s 132 | zstyle ":completion:*" verbose true 133 | 134 | zstyle ":completion:*:*:kill:*:processes" list-colors "=(#b) #([0-9]#)*=0=01;31" 135 | zstyle ":completion:*:kill:*" command "ps -u $USER -o pid,%cpu,tty,cputime,cmd" 136 | 137 | 138 | ## 139 | # Keybinds 140 | # 141 | 142 | # Use emacs-style keybindings 143 | bindkey -e 144 | 145 | bindkey "$terminfo[khome]" beginning-of-line # Home 146 | bindkey "$terminfo[kend]" end-of-line # End 147 | bindkey "$terminfo[kich1]" overwrite-mode # Insert 148 | bindkey "$terminfo[kdch1]" delete-char # Delete 149 | bindkey "$terminfo[kcuu1]" up-line-or-history # Up 150 | bindkey "$terminfo[kcud1]" down-line-or-history # Down 151 | bindkey "$terminfo[kcub1]" backward-char # Left 152 | bindkey "$terminfo[kcuf1]" forward-char # Right 153 | # bindkey "$terminfo[kpp]" # PageUp 154 | # bindkey "$terminfo[knp]" # PageDown 155 | 156 | # Bind ctrl-left / ctrl-right 157 | bindkey "\e[1;5D" backward-word 158 | bindkey "\e[1;5C" forward-word 159 | 160 | # Bind ctrl-backspace to delete word. 161 | # NOTE: This may not work properly in some emulators 162 | # bindkey "^?" backward-delete-word 163 | 164 | # Bind shift-tab to backwards-menu 165 | # NOTE this won't work on Konsole if the new tab button is shown 166 | bindkey "\e[Z" reverse-menu-complete 167 | 168 | # Make ctrl-e edit the current command line 169 | autoload edit-command-line 170 | zle -N edit-command-line 171 | bindkey "^e" edit-command-line 172 | 173 | # Make sure the terminal is in application mode, when zle is 174 | # active. Only then are the values from $terminfo valid. 175 | if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then 176 | function zle-line-init { 177 | printf "%s" ${terminfo[smkx]} 178 | } 179 | function zle-line-finish { 180 | printf "%s" ${terminfo[rmkx]} 181 | } 182 | zle -N zle-line-init 183 | zle -N zle-line-finish 184 | fi 185 | 186 | # typing ... expands to ../.., .... to ../../.., etc. 187 | rationalise-dot() { 188 | if [[ $LBUFFER = *.. ]]; then 189 | LBUFFER+=/.. 190 | else 191 | LBUFFER+=. 192 | fi 193 | } 194 | zle -N rationalise-dot 195 | bindkey . rationalise-dot 196 | bindkey -M isearch . self-insert # history search fix 197 | 198 | 199 | ## 200 | # Aliases 201 | # 202 | 203 | # some more ls aliases 204 | alias l="ls -CF" 205 | alias ll="ls -lh" 206 | alias la="ls -A" 207 | alias sl="ls" 208 | 209 | # Make unified diff syntax the default 210 | alias diff="diff -u" 211 | 212 | # octal+text permissions for files 213 | alias perms="stat -c '%A %a %n'" 214 | 215 | # expand sudo aliases 216 | alias sudo="sudo " 217 | 218 | # Default 219 | alias hexdump="hexdump --canonical" 220 | 221 | # Default 222 | alias xclip="xclip -selection clipboard" 223 | 224 | # Pastebin contents to https://paste.rs/ 225 | # alias dpaste="curl -F 'format=url' -F 'content=<-' https://dpaste.de/" 226 | alias dpaste="curl --data-binary @- https://paste.rs/" 227 | 228 | 229 | ## 230 | # Functions 231 | # 232 | 233 | # make a backup of a file 234 | # https://github.com/grml/grml-etc-core/blob/master/etc/zsh/zshrc 235 | bk() { 236 | cp -a "$1" "${1}_$(date --iso-8601=seconds)" 237 | } 238 | 239 | # display a list of supported colors 240 | function lscolors { 241 | ((cols = $COLUMNS - 4)) 242 | s=$(printf %${cols}s) 243 | for i in {000..$(tput colors)}; do 244 | echo -e $i $(tput setaf $i; tput setab $i)${s// /=}$(tput op); 245 | done 246 | } 247 | 248 | # get the content type of an http resource 249 | function htmime { 250 | if [[ -z $1 ]]; then 251 | print "USAGE: htmime " 252 | return 1 253 | fi 254 | mime=$(curl -sIX HEAD $1 | sed -nr "s/Content-Type: (.+)/\1/p") 255 | print $mime 256 | } 257 | 258 | # open a web browser on google for a query 259 | function google { 260 | xdg-open "https://www.google.com/search?q=`urlencode "${(j: :)@}"`" 261 | } 262 | 263 | # print a separator banner, as wide as the terminal 264 | function hr { 265 | print ${(l:COLUMNS::=:)} 266 | } 267 | 268 | # launch an app 269 | function launch { 270 | type $1 >/dev/null || { print "$1 not found" && return 1 } 271 | $@ &>/dev/null &| 272 | } 273 | alias launch="launch " # expand aliases 274 | 275 | # Useful python aliases/functions 276 | 277 | # simple webserver to serve the current directory 278 | alias mkhttp="python -m http.server" 279 | 280 | # Prettify JSON: 281 | alias json="python -m json.tool" 282 | # Convert yaml to pretty JSON: 283 | alias yaml="python -c 'import json, sys, yaml; y=yaml.safe_load(sys.stdin.read()); print(json.dumps(y, indent=4))'" 284 | 285 | # https://stackoverflow.com/questions/6250698/how-to-decode-url-encoded-string-in-shell 286 | # Encode with URLEncode 287 | 288 | function urlencode { 289 | python -c "import sys; from urllib.parse import quote_plus; print(quote_plus(sys.stdin.read()))" 290 | } 291 | 292 | # Decode URLencoded string 293 | function urldecode { 294 | python -c "import sys; from urllib.parse import unquote; print(unquote(sys.stdin.read()), end='')" 295 | } 296 | 297 | # Convert a querystring into pretty JSON 298 | function urlarray { 299 | python -c "import sys, json; from urllib.parse import parse_qs; print(json.dumps({k: q[0] if len(q) == 1 else q for k, q in parse_qs(sys.stdin.read()).items()}), end='')" | json 300 | } 301 | 302 | # get public ip 303 | function myip { 304 | local api 305 | case "$1" in 306 | "-4") 307 | api="http://v4.ipv6-test.com/api/myip.php" 308 | ;; 309 | "-6") 310 | api="http://v6.ipv6-test.com/api/myip.php" 311 | ;; 312 | *) 313 | api="http://ipv6-test.com/api/myip.php" 314 | ;; 315 | esac 316 | curl -s "$api" 317 | echo # Newline. 318 | } 319 | 320 | 321 | ## 322 | # Extras 323 | # 324 | 325 | # Git plugin 326 | autoload -Uz vcs_info 327 | zstyle ":vcs_info:*" enable git 328 | zstyle ":vcs_info:(git*):*" get-revision true 329 | zstyle ":vcs_info:(git*):*" check-for-changes true 330 | 331 | local _branch="%c%u%m %{$fg[green]%}%b%{$reset_color%}" 332 | local _repo="%{$fg[green]%}%r %{$fg[yellow]%}%{$reset_color%}" 333 | local _revision="%{$fg[yellow]%}%.7i%{$reset_color%}" 334 | local _action="%{$fg[red]%}%a%{$reset_color%}" 335 | zstyle ":vcs_info:*" stagedstr "%{$fg[yellow]%}✓%{$reset_color%}" 336 | zstyle ":vcs_info:*" unstagedstr "%{$fg[red]%}✗%{$reset_color%}" 337 | zstyle ":vcs_info:git*" formats "$_branch:$_revision - $_repo" 338 | zstyle ":vcs_info:git*" actionformats "$_branch:$_revision:$_action - $_repo" 339 | zstyle ':vcs_info:git*+set-message:*' hooks git-stash 340 | # Uncomment to enable vcs_info debug mode 341 | # zstyle ':vcs_info:*+*:*' debug true 342 | 343 | function +vi-git-stash() { 344 | if [[ -s "${hook_com[base]}/.git/refs/stash" ]]; then 345 | hook_com[misc]="%{$fg_bold[grey]%}~%{$reset_color%}" 346 | fi 347 | } 348 | 349 | precmd() { 350 | vcs_info 351 | } 352 | 353 | # Syntax highlighting plugin 354 | if [[ -e /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then 355 | source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 356 | elif [[ -e /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then 357 | source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 358 | fi 359 | 360 | # Autosuggestion plugin 361 | if [[ -e /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then 362 | source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 363 | fi 364 | 365 | # virtualenvwrapper support 366 | # Remember to set $PROJECT_HOME in your profile file! 367 | if command -V virtualenvwrapper_lazy.sh >/dev/null 2>&1; then 368 | export WORKON_HOME="$XDG_DATA_HOME/virtualenvs" 369 | source virtualenvwrapper_lazy.sh 370 | # Arch linux uses python3 by default, this is required to make python2-compatible projects 371 | alias mkproject2="mkproject -p /usr/bin/python2" 372 | alias mkvirtualenv2="mkvirtualenv -p /usr/bin/python2" 373 | fi 374 | 375 | # User profile 376 | if [[ -e "$XDG_CONFIG_HOME/zsh/profile" ]]; then 377 | source "$XDG_CONFIG_HOME/zsh/profile" 378 | fi 379 | 380 | # Check if $LANG is badly set as it causes issues 381 | if [[ $LANG == "C" || $LANG == "" ]]; then 382 | >&2 echo "$fg[red]The \$LANG variable is not set. This can cause a lot of problems.$reset_color" 383 | fi 384 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dotfiles 2 | ======== 3 | 4 | .zshrc and cousins 5 | 6 | ![image](https://cloud.githubusercontent.com/assets/235410/6504067/7899cc44-c333-11e4-9b72-26cf4493841a.png "Screenshot of a ZSH session") 7 | 8 | 9 | ## Features 10 | 11 | * [XDG basedirs](http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html) 12 | * Powerline support if installed 13 | * virtualenvwrapper support if installed 14 | * zsh-syntax-highlight support if installed 15 | * Git integration enabled 16 | * 256-color support by default 17 | * Colors enabled by default in ls, grep, dmesg and less! 18 | * Add your extra stuff in `$XDG_CONFIG_HOME/zsh/profile` 19 | * Put your custom completions in `$XDG_CONFIG_HOME/zsh/completion/` 20 | * Saner defaults for `diff`, `hexdump`, `xclip` and more 21 | 22 | ### More aliases 23 | 24 | * **bk** \: Back up a file 25 | * **htmime** \: Get the content type of a URL 26 | * **google** \: Open your default browser on a google query 27 | * **hr**: print a terminal-wide banner 28 | * **launch** \ [args]: Launch a binary, disowning it from the terminal immediately 29 | * **lscolors**: list all available colors 30 | * **perms** \: Print file permissions (octal and text) 31 | * **myip**: Print the machine's public ip (uses ifconfig.me service) 32 | * **sprunge**: Pastebin stdin (uses sprunge.us service) 33 | 34 | 35 | #### Requires Python 3+ 36 | 37 | * **mkhttp**: Run a webserver in cwd (uses Python 3 http.server) 38 | * **urlencode**: Quote stdin with url-encoding (percent-encoding) 39 | * **urldecode**: Unquote percent-encoded stdin 40 | * **urlarray**: Convert a querystring into pretty JSON 41 | * **json**: Indent and prettify json code 42 | * **yaml**: Print YAML contents as pretty-JSON 43 | 44 | 45 | ### Other fun stuff 46 | 47 | * Ctrl+E: Edit the current line in your $EDITOR 48 | * Expand "...": Typing ... is expanded to ../..; .... expands to ../../.. and so on. 49 | * Typing a naked directory assumes "cd " is implied. 50 | * The "⇄" icon will show up on the right side of the tty when the shell is running in a SSH session. 51 | 52 | 53 | ## Compatibility 54 | 55 | This script requires Zsh >= 5.0. A 4.0-compatible version, with less features, 56 | is available in the `compat/` folder. 57 | NOTE: Cygwin users should set `TERM=cygwin` in their profile file, otherwise 58 | keybindings may be messed up. 59 | -------------------------------------------------------------------------------- /base-packages: -------------------------------------------------------------------------------- 1 | # core 2 | git 3 | openssh 4 | python 5 | wget 6 | zsh 7 | 8 | # CLI utilities 9 | ack 10 | bind-tools 11 | rsync 12 | strace 13 | traceroute 14 | tree 15 | unrar 16 | unzip 17 | cabextract 18 | dnsutils 19 | fdupes 20 | htop 21 | iotop 22 | hexedit 23 | lshw 24 | lsof 25 | lynx 26 | mlocate 27 | parted 28 | perl-rename 29 | proxychains-ng 30 | whois 31 | wpa_supplicant 32 | zsh-syntax-highlighting 33 | 34 | # Extras (arch + compat) 35 | acpi 36 | beep 37 | dialog 38 | macchanger 39 | pkgfile 40 | sshfs 41 | 42 | # Apps 43 | lxqt 44 | chromium 45 | keepassxc 46 | qbittorrent 47 | qterminal 48 | zuluCrypt 49 | -------------------------------------------------------------------------------- /bin/git-biggest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -x 3 | 4 | # Shows you the largest objects in your repo's pack file. 5 | # Written for osx. 6 | # 7 | # @see https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/ 8 | # @author Antony Stubbs 9 | 10 | # set the internal field spereator to line break, so that we can iterate easily over the verify-pack output 11 | IFS=$'\n'; 12 | 13 | # list all objects including their size, sort by size, take top 10 14 | objects=`git verify-pack -v .git/objects/pack/pack-*.idx | grep -v chain | sort -k3nr | head` 15 | 16 | echo "All sizes are in kB's. The pack column is the size of the object, compressed, inside the pack file." 17 | 18 | output="size,pack,SHA,location" 19 | allObjects=`git rev-list --all --objects` 20 | for y in $objects 21 | do 22 | # extract the size in bytes 23 | size=$((`echo $y | cut -f 5 -d ' '`/1024)) 24 | # extract the compressed size in bytes 25 | compressedSize=$((`echo $y | cut -f 6 -d ' '`/1024)) 26 | # extract the SHA 27 | sha=`echo $y | cut -f 1 -d ' '` 28 | # find the objects location in the repository tree 29 | other= `echo "${allObjects}" | grep $sha` 30 | #lineBreak=`echo -e "\n"` 31 | output="${output}\n${size},${compressedSize},${other}" 32 | done 33 | 34 | echo -e $output | column -t -s ', ' 35 | -------------------------------------------------------------------------------- /bin/git-update-committer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git filter-branch -f --env-filter ' 4 | export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" 5 | export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" 6 | export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" 7 | ' $@ 8 | -------------------------------------------------------------------------------- /bin/git-update-email: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git filter-branch -f --env-filter ' 4 | old="'"$1"'" 5 | new="'"$2"'" 6 | am="$GIT_AUTHOR_EMAIL" 7 | cm="$GIT_COMMITTER_EMAIL" 8 | 9 | if [ "$GIT_COMMITTER_EMAIL" = "$old" ]; then 10 | cm="$new" 11 | fi 12 | 13 | if [ "$GIT_AUTHOR_EMAIL" = "$old" ]; then 14 | am="$new" 15 | fi 16 | 17 | export GIT_AUTHOR_EMAIL="$am" 18 | export GIT_COMMITTER_EMAIL="$cm" 19 | ' 20 | -------------------------------------------------------------------------------- /bin/git-update-name: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git filter-branch -f --env-filter ' 4 | old="'"$1"'" 5 | new="'"$2"'" 6 | am="$GIT_AUTHOR_NAME" 7 | cm="$GIT_COMMITTER_NAME" 8 | 9 | if [ "$GIT_COMMITTER_NAME" = "$old" ]; then 10 | cm="$new" 11 | fi 12 | 13 | if [ "$GIT_AUTHOR_NAME" = "$old" ]; then 14 | am="$new" 15 | fi 16 | 17 | export GIT_AUTHOR_NAME="$am" 18 | export GIT_COMMITTER_NAME="$cm" 19 | ' 20 | -------------------------------------------------------------------------------- /install-arch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ $EUID -ne 0 ]]; then 4 | echo "Must be root." 1>&2 5 | exit 1 6 | fi 7 | 8 | 9 | if [[ ! -f /etc/hostname ]]; then 10 | echo -n "Enter a hostname for this machine: " 11 | read hostname 12 | echo 13 | echo $hostname > /etc/hostname 14 | fi 15 | 16 | # Make zsh the default shell 17 | chsh -s /usr/bin/zsh 18 | cp .zshrc ~ 19 | cp .zshrc /etc/skel 20 | mkdir -p ~/.config /etc/skel/.config ~/.cache /etc/skel/.cache 21 | 22 | 23 | # Set LANG 24 | echo "Setting LANG to en_US.UTF-8. Change it in /etc/locale.gen then run locale-gen" 25 | sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen 26 | locale-gen 27 | echo LANG=en_US.UTF-8 > /etc/locale.conf 28 | 29 | echo "Please enter password for root user." 30 | passwd 31 | 32 | echo "Creating a default user. This user will be part of the wheel group and as such will be able to use sudo." 33 | echo -n "Please enter a username (leave blank to skip): " 34 | read username 35 | echo 36 | 37 | if [[ "$username" != "" ]]; then 38 | useradd $username --create-home -s /usr/bin/zsh -g users -G wheel 39 | echo "Created user $username" 40 | sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/" /etc/sudoers 41 | passwd $username 42 | fi 43 | 44 | if [[ -d /sys/firmware/efi/efivars ]]; then 45 | echo -n "Do you want to install systemd-boot? [y/N] " 46 | read y 47 | if [[ "$y" == "y" || "$y" == "Y" ]]; then 48 | bootctl install 49 | partition=$(findmnt --noheadings --output=source /) 50 | uuid=$(blkid -o value -s PARTUUID $partition) 51 | printf "%s\n" "default arch" "timeout 3" >> /boot/loader/loader.conf 52 | printf "%s\n" \ 53 | "title Arch Linux" \ 54 | "linux /vmlinuz-linux" \ 55 | "initrd /initramfs-linux.img" \ 56 | "options root=PARTUUID=$uuid rw" > /boot/loader/entries/arch.conf 57 | echo "Configured in /boot/loader/loader.conf and /boot/loader/entries/arch.conf" 58 | fi 59 | else 60 | echo -n "Do you want to install syslinux? [y/N] " 61 | read y 62 | if [[ "$y" == "y" || "$y" == "Y" ]]; then 63 | pacman -S syslinux gptfdisk --noconfirm 64 | syslinux-install_update -iam 65 | echo "WARNING: syslinux autodetection can be erroneous. You may need to edit /boot/syslinux/syslinux.cfg." 66 | fi 67 | fi 68 | 69 | 70 | # Basic system configuration 71 | 72 | # Console font (see man 5 vconsole.conf) 73 | # Setting to eurlatgr, courtesy of Fedora 74 | echo "FONT=eurlatgr" >> /etc/vconsole.conf 75 | 76 | # Basic pacman configuration 77 | sed -i "s/#Color/Color/" /etc/pacman.conf 78 | sed -i "s/#VerbosePkgLists/VerbosePkgLists/" /etc/pacman.conf 79 | 80 | echo "Configuring repository mirrors..." 81 | echo 'Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist 82 | pacman -Syy 83 | if [[ -f base-packages ]]; then 84 | pacman -S $(cat base-packages) 85 | fi 86 | 87 | if [[ -f /usr/bin/dash ]]; then 88 | echo "Replacing /usr/bin/sh by dash. Reinstall core/bash to revert." 89 | ln -sf --backup /usr/bin/dash /usr/bin/sh && rm "/usr/bin/sh~" 90 | else 91 | echo "Not setting up dash." 92 | fi 93 | 94 | mkinitcpio -p linux 95 | 96 | # Time settings 97 | timedatectl set-timezone UTC 98 | timedatectl set-ntp true 99 | hwclock --systohc --utc 100 | echo "NTP has been enabled and hardware clock will be in UTC. More information: https://wiki.archlinux.org/index.php/Time" 101 | 102 | if [[ -f /etc/vimrc ]]; then 103 | echo "Enabling some base vim settings" 104 | printf "%s\n" "syntax on" "filetype plugin indent on" "colorscheme darkblue" "set number" >> /etc/vimrc 105 | fi 106 | --------------------------------------------------------------------------------