Skip to content

Instantly share code, notes, and snippets.

View cmndrsp0ck's full-sized avatar
🖖
Fascinating

Fabian B. cmndrsp0ck

🖖
Fascinating
View GitHub Profile
@cmndrsp0ck
cmndrsp0ck / vimrc.local
Created February 7, 2024 05:06
simple vimrc configuration - no plugins
syntax on
set relativenumber
set number
set tabstop=4
set shiftwidth=4
set expandtab
set smartindent
set autoindent
set hidden
set autoread
@cmndrsp0ck
cmndrsp0ck / go-update.sh
Created January 7, 2023 05:37
golang update function
function go-update() {
DSTORE=${HOME}/Programs;
CURRENT_INSTALL=$(go version | cut -d" " -f3 | cut -do -f2)
LATEST_STABLE=$(curl -Ss https://go.dev/dl/ | grep -Po '>go.*linux-amd64\.tar\.gz' | cut -d'>' -f2 | head -1);
LATEST_VERSION=$(echo $LATEST_STABLE | grep -Po '[0-9]+\.[0-9]+(\.[0-9]+)?')
if [[ ${CURRENT_INSTALL} == ${LATEST_VERSION} ]]; then
printf "\nLatest stable version already installed. ${LATEST_VERSION}\n"
else
printf "\nCurrently installed version: ${CURRENT_INSTALL}.\nNewer version ${LATEST_VERSION} is available.\n"
@cmndrsp0ck
cmndrsp0ck / makePass.sh
Created January 7, 2023 05:35
Generate variable length password in cli
function makePass() {
LC_CTYPE=C;
local len=${1:-14}
local my_pass=$(tr -dc 'A-Za-z0-9_@#%^&*()-+=' < /dev/urandom | head -c ${len})
echo "${my_pass}";
}
@cmndrsp0ck
cmndrsp0ck / mkcd
Last active January 7, 2023 05:33
mkdir and cd into it
# set in ${HOME}/.bashrc
function mkcd() {
mkdir -p "$@" && cd -- "$_"
}
@cmndrsp0ck
cmndrsp0ck / init.vim
Last active November 29, 2022 08:29
neovim configuration file
"----------------------------------------------
" Plugin management
"
" Download vim-plug from the URL below and follow the installation
" instructions:
" https://github.com/junegunn/vim-plug
"----------------------------------------------
call plug#begin('~/.vim/plugged')
" Dependencies
@cmndrsp0ck
cmndrsp0ck / synclient-toggle.sh
Last active November 9, 2022 19:03
using this to toggle touchpad with a keyboard shortcut
#!/bin/bash
set -e
trkpad=$(synclient | grep -i 'touchpadoff' | awk '{print $(NF)}')
if (( trkpad == 0 )); then
synclient TouchpadOff=1
notify-send -t 1500 'Touchpad Disabled'
else
@cmndrsp0ck
cmndrsp0ck / tmux.md
Created August 11, 2022 02:25 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@cmndrsp0ck
cmndrsp0ck / ansible-vim-goto-role-tasks.vim
Created May 4, 2022 07:45 — forked from mtyurt/ansible-vim-goto-role-tasks.vim
With pearofducs/ansible-vim plugin installed, following mapping behaves like `gf`, navigates to role under cursor's tasks/main.yml file. Ideal to be used in playbooks
" vim-plug example
call plug#begin('~/.vim/plugged')
Plug 'pearofducks/ansible-vim'
call plug#end()
let g:ansible_goto_role_paths = './roles,../_common/roles'
function! FindAnsibleRoleUnderCursor()
if exists("g:ansible_goto_role_paths")
let l:role_paths = g:ansible_goto_role_paths
@cmndrsp0ck
cmndrsp0ck / tilix_backup.sh
Created May 1, 2022 08:04 — forked from peterrus/tilix_backup.sh
Backs up and restores Tilix settings
#!/usr/bin/env bash
# Backs up and restores tilix settings
set -e
if [[ $1 == 'backup' ]]; then
dconf dump '/com/gexperts/Tilix/' > tilix-settings.dconf
echo "backup done"
exit 0