Skip to content

Instantly share code, notes, and snippets.

@beli-sk
beli-sk / plumbing.md
Last active February 16, 2024 04:07 — forked from schacon/plumbing.md
git plumbing cheat sheet

the plumbing commands

refs

  • update-ref

    • update a branch (or other reference) to point to a specific commit sha
  • symbolic-ref

    • update a reference (usually HEAD) to point to another reference (like a branch)
@beli-sk
beli-sk / gvimrc.local
Last active July 31, 2023 08:21
My personal vim config
colorscheme evening
set columns=120 lines=35
"set guifont=Inconsolata\ 13
@beli-sk
beli-sk / git-prompt.sh
Created August 2, 2021 21:11
git prompt on Gentoo
# /etc/bash/bashrc.d/git-prompt.sh
. /usr/share/git/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
if ${use_color} ; then
PS1=`echo "$PS1" | sed -r 's| \\\\\\$|\\\[\\\\033[01;31m\\\]$(__git_ps1)\\\[\\\\033[01;34m\\\] \\\\$|'`
else
PS1=`echo "$PS1" | sed -r 's| \\\\\\$|$(__git_ps1) \\\\$|'`
fi
@beli-sk
beli-sk / kubens_bashrc.sh
Last active July 28, 2021 14:56
Bash: set default namespace for kubectl command
### kubens - set default namespace for kubectl command
function kubens {
if [[ -n "$1" ]] ; then
alias kubectl="kubectl -n $1"
export HELM_NAMESPACE="$1"
PS1=$( echo "$PS1" | sed -r 's/(.*)\(ns:[^)]*\)(.*)/\1\2/' )
PS1="(ns:$1)${PS1}"
else
unalias kubectl
@beli-sk
beli-sk / inputrc
Created January 9, 2020 08:45
Bash (or any readline prompt) vi-mode with tweaks
set editing-mode vi
set show-mode-in-prompt on
set vi-ins-mode-string "+"
set vi-cmd-mode-string ":"
$if mode=vi
set keymap vi-command
# these are for vi-command mode
Control-l: clear-screen
@beli-sk
beli-sk / irexec.desktop
Last active April 5, 2019 19:14
LIRC Pulseaudio volume with Creative SB X-Fi Surround 5.1 Pro
[Desktop Entry]
Name=Irexec daemon
Comment=Handle IR command server
Exec=/usr/bin/irexec
Icon=applications-system
Terminal=false
Type=Application
Categories=AudioVideo;Application;X-Fedora-Extra
@beli-sk
beli-sk / tmux.conf
Last active March 4, 2019 11:42
My personal tmux config
#set -g status off
#set -g status-right "\"#{=32:pane_title}\""
setw -g mode-keys vi
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel
bind-key S setw synchronize-panes
@beli-sk
beli-sk / kubetmp.sh
Last active February 25, 2019 13:43
Kubernetes: kubectl temporary environment per session
#!/bin/bash
# to be sourced by interactive shell or added to .bashrc
#
# kubectl temporary environment per session
# - any `kubectl config` changes (like use-context) go to temporary file
#
KUBETMPDIR=`mktemp -d`
[[ "$1" == "--merged" || "$1" == "-m" ]] && touch "${KUBETMPDIR}/kubeconfig" || cp "${HOME}/.kube/config" "${KUBETMPDIR}/kubeconfig"
eval "function kubetmp_cleanup {
rm -f ${KUBETMPDIR}/kubeconfig
@beli-sk
beli-sk / Disable gnome-keyring-ssh
Last active September 7, 2018 08:54
Disable Gnome Keyring SSH agent in (X)Ubuntu
# Disable Gnome Keyring SSH agent in Ubuntu
# To allow using ssh-agent from OpenSSH, mainly because
# gnome-keyring does not like EC-type SSH keys
# as regular user (for which to disable):
systemctl --user mask gnome-keyring-ssh.service
pam-auth-update
# and disable "GNOME Keyring Daemon..."
# which probably also disables automatic keyring unlocking on login
@beli-sk
beli-sk / bash_oneliners.sh
Last active July 18, 2017 14:38
Useful CLI one-liners (Linux)
# Number of open file descriptors per process (replace 'httpd' with process name)
lsof -p $( echo `ps -o pid= -C httpd` | tr ' ' ',' ) | awk '{ print $2 }' | uniq -c
# Show swap usage per process, >=1000 kB
cat /proc/*/status | egrep -B30 '^VmSwap:[[:space:]]+[[:digit:]]{4,}' | egrep '^Name|^Pid|^VmSwap'
# generate password
head -c12 /dev/urandom | base64 | tr '+/' '_-' | tr -d '='
# days to web server certificate expiry