Skip to content

Instantly share code, notes, and snippets.

@ajgappmark
Last active November 5, 2024 08:50
Show Gist options
  • Save ajgappmark/4df20d4f9314e765713a5a27623813f1 to your computer and use it in GitHub Desktop.
Save ajgappmark/4df20d4f9314e765713a5a27623813f1 to your computer and use it in GitHub Desktop.
#= essential ubuntu/mint installations
sudo apt-get install -y autoconf build-essential g++ git vim ack-grep at tree htop tmux xclip x11-xkb-utils openjdk-8-jre openjdk-8-jdk-headless jq python3-pip libsource-highlight-common source-highlight most exuberant-ctags
sudo apt-get install -y datamash network-manager neofetch openssh-server cmake subversion feh sxiv
sudo apt-get install meld sublime-text gimp blender inkscape
sudo apt-get install mpv audacious audacity
#= git setup
$ git config --global user.email "[email protected]"
$ git config --global user.name "Your Name"
#== tmux usage
#- commands
$ tmux list-sessions
$ tmux new -s <sessionname> # new session
$ tmux kill-session -t <sessionname> # kill session
$ tmux attach <sessionname> # existing session, attach to
$ tmux attach-session -t <sessionname>
#- shortcuts
Ctrl-b d # detach from session
Ctrl-b [ then pgup/pgdn. q to quit #scroll in a pane
Ctrl-b x # y kill a session
Ctrl-b % # split vertical
Ctrl-b " # split hor
Ctrl-b arrowkeys # move between panes
Ctrl-b { or } # swap panes
$ exit # kill pane
#= open new pane of tmux in same directory, (use if needed)
$ cat <<EOF 1>~/.tmux.conf
# Set new panes to open in current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
set -g default-terminal "xterm-256color" # set vim no color on tmux v3.2+
set -g status-bg black # changing distracting color of status bar
set -g status-fg white #
set -g renumber-windows on # tmux 1.7+: enable sequential numbering of windows
EOF
#- hot reload tmux conf file
$ tmux source-file ~/.tmux.conf
#= system-wide basic vim config
# cat <<EOF 1>/etc/vim/vimrc.local
" setup vundle
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set number " turn on line numbers
syntax enable " enable syntax processing
colorscheme elflord " default color scheme
set hlsearch " highlight search results
set ignorecase " ignore case when searching
set incsearch " search as characters are entered
set hlsearch " highlight all matches
set ts=4 sw=4 " set tabspace and shiftwidth to 4 spaces
set nopaste " disable garbled indentation on paste from clipboard
set laststatus=2 " show statusline
set statusline+=%F " display full filename of current file
EOF
#==== essentials for .bashrc ===============
#- map caps-ctrl
$ setxkbmap -layout us -option ctrl:nocaps
$ cat /etc/default/keyboard # add the following lines, this method works for both console and x11
XKBLAYOUT=us
XKBVARIANT=
XKBOPTIONS=ctrl:nocaps
##=== Prompt Style and exports =============
export LC_NUMERIC="en_US.UTF-8" # to prevent datamash complains
# lightgreen - for local user append inside ~/.bashrc
export PROMPT_DIRTRIM=2
export PS1='`if [ $? = 0 ]; then echo "\[\033[01;32m\]✔"; else echo "\[\033[01;31m\]✘"; fi` \[\033[0;32m\][\u@\h\[\033[01;32m\] \w\[\033[35m\]$(__git_ps1 " %s") \[\033[01;32m\]]$ \[\033[00m\]'
#- with datetime
export PS1="[\u@\h \D{%Y%m%d-%H:%M:%S} \w]\$ "
export PS1='`if [ $? = 0 ]; then echo "\[\033[01;32m\]✔"; else echo "\[\033[01;31m\]✘"; fi` \[\033[0;32m\][\u@\h \[\033[0;38;5;135m\]\D{%H:%M %d/%m} \[\033[01;32m\]\w\[\033[35m\]$(__git_ps1 " %s") `if [ -n "$(git status -s 2>/dev/null)" ]; then echo "\[\033[01;35m\]▴"; fi`\[\033[01;32m\]]$ \[\033[00m\]'
#- teal colored
export PS1='`if [ $? = 0 ]; then echo "\[\033[01;32m\]✔"; else echo "\[\033[01;31m\]✘"; fi` \[\033[0;36m\][\u@\h\[\033[01;32m\] \w\[\033[35m\]$(__git_ps1 " %s") \[\033[01;32m\]]$ \[\033[00m\]'
#- for root user append inside /root/.bashrc
export PS1='`if [ $? = 0 ]; then echo "\[\033[01;32m\]✔"; else echo "\[\033[01;31m\]✘"; fi` \[\033[0;31m\][\u@\h\[\033[01;35m\] \W\[\033[35m\]]# \[\033[00m\]'
#- two lines with datetime
export PS1='`if [ $? = 0 ]; then echo "\[\033[01;32m\]✔"; else echo "\[\033[01;31m\]✘"; fi` \[\033[0;32m\][\u@\h\[\033[01;32m\] \w\[\033[35m\]$(__git_ps1 " %s") `if [ -n "$(git status -s 2>/dev/null)" ]; then echo "\[\033[01;35m\]▴";fi`\[\033[0;32m\]]-(\[\033[00;34m\]\D{%a %d, %h %H:%M}\[\033[0;32m\])\n└─\[\033[1;32m\]\$ \[\033[0m\]'
export LC_NUMERIC="en_US.UTF-8" # for datamash number format
export QUOTING_STYLE=literal # for ls (suppress surrounding quotes 'blah 1')
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s" # less for source code highlighting
export LESS=' -R ' # same as above
export EDITOR="vi" # set default editor for utils like less
PROMPT_COMMAND="export PROMPT_COMMAND=echo" # add newline after o/p of each bash command
##=== Aliases ==============================
alias ]="xdg-open "
alias xclip='xclip -selection c'
alias puttyusb0='sudo putty -serial /dev/ttyUSB0 -fn "Monospace 14" -sercfg 115200,8,n,1,N '
alias t='tmux attach || tmux new-session\; split-window -h'
# Attaches tmux to the last session; creates a new session if none exists.
alias t='tmux attach || tmux new-session'
# Attaches tmux to a session (example: ta portal)
alias ta='tmux attach -t'
# Creates a new session
alias tn='tmux new -s '
# Lists all ongoing sessions
alias tl='tmux list-sessions'
#= disable astericks for password characters
$ sudo mv /etc/sudoers.d/0pwfeedback /etc/sudoers.d/0pwfeedback.disabled
#= custom keyboard shortcuts (lm, ubuntu)
$ dconf load /org/cinnamon/desktop/keybindings/ << EOF
[media-keys]
previous=['XF86AudioPrev', '<Super>Left']
next=['XF86AudioNext', '<Super>Right']
play=['XF86AudioPlay', '<Super>Down']
terminal=['<Primary><Alt>t', '<Super>Escape']
[wm]
push-tile-left=@as []
push-tile-down=@as []
push-tile-right=@as []
EOF
#= font ttf
- https://fontsfree.net//wp-content/fonts/basic/fixed-width/FontsFree-Net-SLC_.ttf
- https://fonts.google.com/specimen/Courier+Prime
#= Terminal profiles
$ dconf load /org/gnome/terminal/legacy/profiles:/ << EOF
[/]
list=['b1dcc9dd-5262-4d8d-a863-c897e6d979b9', '26ae9d60-31d6-44ff-bb5a-ad6cc2274404']
[:26ae9d60-31d6-44ff-bb5a-ad6cc2274404]
background-color='rgb(23,20,33)'
cursor-shape='ibeam'
font='Courier 10 Pitch Medium 12'
foreground-color='rgb(208,207,204)'
use-system-font=false
use-theme-colors=false
visible-name='courier'
[:b1dcc9dd-5262-4d8d-a863-c897e6d979b9]
background-color='rgb(0,0,0)'
cursor-shape='ibeam'
foreground-color='rgb(170,170,170)'
use-system-font=false
use-theme-colors=false
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment