Skip to content

Instantly share code, notes, and snippets.

View auwsom's full-sized avatar


View GitHub Profile
This is an old version. See the new one in my dotfiles repo:
## These lines for importing these command aliases and functions into .bash_aliases (or .bashrc), the settings file for bash
# `wget -O ~/.bash_aliases && source ~/.bashrc`
# `wget -O ~/.bash_aliases && source ~/.bashrc`
# `cp -f ~/.bash_aliases /home/user/.bash_aliases && chown user:user /home/user/.bash_aliases`
#shellcheck "$0" # `apt install shellcheck` to check any script for any errors. uncomment line to check this one.
# see further down for more general Linux tips and learning sites
# unalias a
alias rm='rm -I'
shopt -s histverify
alias h='history'
alias hh='history | tail -30'
alias rb='source ~/.bashrc'
auwsom / vim basics
Last active June 6, 2022 04:40
vim basics
:q, :wq, :q!, ZZ # quit, write quit, quit force, write quit
i, Esc, v # insert mode, exit mode, visual mode
dd, dw, x, u, U, ctrl+r # cut line, cut word, delete char, undo, undo line, redo (:redo)
yy, pp, Y, o # copy line, paste line, open line
a, A, # insert at end, or after end
H, M, L, gg, G, 1G, 0, $, ^, {, }, # move to: top, mid, bottom, start/end doc, line 1, start/end line, start non-empty line, paragraph
# wget
while true
load=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 1000 / (t-t1); }' <(grep 'cpu ' /proc/stat) <(sleep 1;grep 'cpu ' /proc/stat))
auwsom / .bashrc echo - old
Last active November 28, 2021 21:40
bash config
# wget or
echo HISTCONTROL=ignorespace:ignoredups:erasedups >>~/.bashrc # no duplicate entries
echo shopt -s histverify >>~/.bashrc # confirm !number commands
echo set -o noclobber >>~/.bashrc ## use >| to force redirection even with noclobber
echo "bind '\",,\": \"\$\"'">>~/.bashrc
echo "bind '\",l\": \"\$_\"'">>~/.bashrc
echo "bind '\",h\": \"--help\"'">>~/.bashrc
echo "alias vimbash='vim ~/.bashrc'">>~/.bashrc
echo "alias rebash='source ~/.bashrc'">>~/.bashrc
auwsom / bash setup for docker
Last active December 17, 2020 00:25
bash setup for docker
# wget -O bashsetup_docker ; bash !$
set +o history && sleep 1
sed -i /^'alias d'/d ~/.bashrc; sed -i /^'function d'/d ~/.bashrc ## remove old
source ~/.bashrc ; exec bash ## have to restart shell to enter the bindings without recursion
#echo "HISTIGNORE=''" >>~/.bashrc
# sudo cp /usr/share/zoneinfo/US/Pacific /etc/localtime # cant set, read only
echo "alias d='docker'">>~/.bashrc
echo "alias dcm='docker commit'">>~/.bashrc # CONTAINER IMAGE_REPO:TAG <- have to specify or creates new image
echo "alias del='docker exec -it \$(docker ps -q -l) bash'">>~/.bashrc
echo "alias di='docker images'">>~/.bashrc
mv ~/DockerfileLeanFoundation.txt Dockerfile
docker build -t myimage .
docker exec -it 6dd923c8f0fe ls /data/
sudo vim Dockerfile
docker exec -it $(docker ps -q) apt list
docker rmi qc123
docker rm 2b25cfd0a98b
docker ps -a
docker info
docker system df
**emacs bash
ctl-e end
ctl-u clear to beg
ctl-w delete word backward
alt-d delete word forward
*! susbtitution
!$ last word
auwsom / gist:f8f1c84aa0af9647fd3efca835b61262
Created October 24, 2018 17:11
CategoryId for YouTube dictionary
var dict1 = {1 :'Film & Animation', 2 :'Autos & Vehicles', 10 :'Music', 15 :'Pets & Animals', 17 :'Sports', 18 :'Short Movies', 19 :'Travel & Events', 20 :'Gaming', 21 :'Videoblogging', 22 :'People & Blogs', 23 :'Comedy', 24 :'Entertainment',
25 :'News & Politics', 26 :'Howto & Style', 27 :'Education', 28 :'Science & Technology', 29 :'Nonprofits & Activism', 30 :'Movies', 31 :'Anime/Animation', 32 :'Action/Adventure', 33 :'Classics', 34 :'Comedy', 35 :'Documentary',
36 :'Drama', 37 :'Family', 38 :'Foreign', 39 :'Horror', 40 :'Sci-Fi/Fantasy', 41 :'Thriller', 42 :'Shorts', 43 :'Shows', 44 :'Trailers'}