Skip to content

Instantly share code, notes, and snippets.

View szg251's full-sized avatar

Szabo Gergely szg251

View GitHub Profile
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
restore_prompt_after_nix_shell() {
if [ "$PS1" != "$NIX_PROMPT" ]; then
PS1=$NIX_PROMPT
PROMPT_COMMAND=""
fi
}
@szg251
szg251 / setup-db.sh
Created December 25, 2019 07:51
PostgreSQL setup script for nix-shell
trap_stack_name() {
local sig=''${1//[^a-zA-Z0-9]/_}
echo "__trap_stack_$sig"
}
extract_trap() {
echo ''${@:3:$(($#-3))}
}
get_trap() {
@szg251
szg251 / setup-db.sh
Created December 25, 2019 07:48
MySQL setup script for nix-shell
#!/bin/sh
DATADIR="$(pwd)/.mysql"
SOCKET="$DATADIR/mysql.sock"
echo $DATADIR
alias query="mysql --socket=$SOCKET --user=root --password=$MYSQL_ROOT_PASSWORD"
resetDB() {
@szg251
szg251 / init.vim
Last active February 17, 2021 09:36
Neovim config
set nocompatible
set number relativenumber
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
set ai!
set foldmethod=syntax
setglobal foldlevelstart=99
set updatetime=300
set ignorecase
" coc
@szg251
szg251 / .tmux.conf
Last active September 23, 2020 02:01
tmux config
unbind C-o
#Terminal colors
set -g default-terminal "screen-256color"
#Vi mode
set-window-option -g mode-keys vi
##Panel switching
#bind h select-pane -L