Last active
October 24, 2021 03:28
-
-
Save Jthomas54/1cb73fce71cd75f0243816b786ae88d1 to your computer and use it in GitHub Desktop.
files and scripts for setting up elementaryOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cb() { | |
local _scs_col="\e[0;32m"; local _wrn_col='\e[1;31m'; local _trn_col='\e[0;33m' | |
# Check that xclip is installed. | |
if ! type xclip > /dev/null 2>&1; then | |
echo -e "$_wrn_col""You must have the 'xclip' program installed.\e[0m" | |
# Check user is not root (root doesn't have access to user xorg server) | |
elif [[ "$USER" == "root" ]]; then | |
echo -e "$_wrn_col""Must be regular user (not root) to copy a file to the clipboard.\e[0m" | |
else | |
# If no tty, data should be available on stdin | |
if ! [[ "$( tty )" == /dev/* ]]; then | |
input="$(< /dev/stdin)" | |
# Else, fetch input from params | |
else | |
input="$*" | |
fi | |
if [ -z "$input" ]; then # If no input, print usage message. | |
echo "Copies a string to the clipboard." | |
echo "Usage: cb <string>" | |
echo " echo <string> | cb" | |
else | |
# Copy input to clipboard | |
echo -n "$input" | xclip -selection c | |
# Truncate text for status | |
if [ ${#input} -gt 80 ]; then input="$(echo $input | cut -c1-80)$_trn_col...\e[0m"; fi | |
# Print status. | |
echo -e "$_scs_col""Copied to clipboard:\e[0m $input" | |
fi | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# We use preexec and precmd hook functions for Bash | |
# If you have anything that's using the Debug Trap or PROMPT_COMMAND | |
# change it to use preexec or precmd | |
# See also https://github.com/rcaloras/bash-preexec | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac | |
# don't put duplicate lines or lines starting with space in the history. | |
# See bash(1) for more options | |
HISTCONTROL=ignoreboth | |
# append to the history file, don't overwrite it | |
shopt -s histappend | |
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
HISTSIZE=1000 | |
HISTFILESIZE=2000 | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# If set, the pattern "**" used in a pathname expansion context will | |
# match all files and zero or more directories and subdirectories. | |
#shopt -s globstar | |
# make less more friendly for non-text input files, see lesspipe(1) | |
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |
# set variable identifying the chroot you work in (used in the prompt below) | |
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | |
debian_chroot=$(cat /etc/debian_chroot) | |
fi | |
# set a fancy prompt (non-color, unless we know we "want" color) | |
case "$TERM" in | |
xterm-color|*-256color) color_prompt=yes;; | |
esac | |
# uncomment for a colored prompt, if the terminal has the capability; turned | |
# off by default to not distract the user: the focus in a terminal window | |
# should be on the output of commands, not on the prompt | |
#force_color_prompt=yes | |
if [ -n "$force_color_prompt" ]; then | |
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | |
# We have color support; assume it's compliant with Ecma-48 | |
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such | |
# a case would tend to support setf rather than setaf.) | |
color_prompt=yes | |
else | |
color_prompt= | |
fi | |
fi | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;35m\]$(parse_git_branch)\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ ' | |
fi | |
unset color_prompt force_color_prompt | |
# enable color support of ls and also add handy aliases | |
if [ -x /usr/bin/dircolors ]; then | |
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
alias ls='ls --color=auto' | |
#alias dir='dir --color=auto' | |
#alias vdir='vdir --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
fi | |
# colored GCC warnings and errors | |
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' | |
# some more ls aliases | |
alias ll='ls -alF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
# Add an "alert" alias for long running commands. Use like so: | |
# sleep 10; alert | |
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' | |
# Alias definitions. | |
# You may want to put all your additions into a separate file like | |
# ~/.bash_aliases, instead of adding them here directly. | |
# See /usr/share/doc/bash-doc/examples in the bash-doc package. | |
if [ -f ~/.bash_aliases ]; then | |
. ~/.bash_aliases | |
fi | |
# enable programmable completion features (you don't need to enable | |
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |
# sources /etc/bash.bashrc). | |
if ! shopt -oq posix; then | |
if [ -f /usr/share/bash-completion/bash_completion ]; then | |
. /usr/share/bash-completion/bash_completion | |
elif [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
fi | |
# If this is an xterm set more declarative titles | |
# "dir: last_cmd" and "actual_cmd" during execution | |
# If you want to exclude a cmd from being printed see line 156 | |
case "$TERM" in | |
xterm*|rxvt*) | |
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\$(print_title)\a\]$PS1" | |
__el_LAST_EXECUTED_COMMAND="" | |
print_title () | |
{ | |
__el_FIRSTPART="" | |
__el_SECONDPART="" | |
if [ "$PWD" == "$HOME" ]; then | |
__el_FIRSTPART=$(gettext --domain="pantheon-files" "Home") | |
else | |
if [ "$PWD" == "/" ]; then | |
__el_FIRSTPART="/" | |
else | |
__el_FIRSTPART="${PWD##*/}" | |
fi | |
fi | |
if [[ "$__el_LAST_EXECUTED_COMMAND" == "" ]]; then | |
echo "$__el_FIRSTPART" | |
return | |
fi | |
#trim the command to the first segment and strip sudo | |
if [[ "$__el_LAST_EXECUTED_COMMAND" == sudo* ]]; then | |
__el_SECONDPART="${__el_LAST_EXECUTED_COMMAND:5}" | |
__el_SECONDPART="${__el_SECONDPART%% *}" | |
else | |
__el_SECONDPART="${__el_LAST_EXECUTED_COMMAND%% *}" | |
fi | |
printf "%s: %s" "$__el_FIRSTPART" "$__el_SECONDPART" | |
} | |
put_title() | |
{ | |
__el_LAST_EXECUTED_COMMAND="${BASH_COMMAND}" | |
printf "\033]0;%s\007" "$1" | |
} | |
# Show the currently running command in the terminal title: | |
# http://www.davidpashley.com/articles/xterm-titles-with-bash.html | |
update_tab_command() | |
{ | |
# catch blacklisted commands and nested escapes | |
case "$BASH_COMMAND" in | |
*\033]0*|update_*|echo*|printf*|clear*|cd*) | |
__el_LAST_EXECUTED_COMMAND="" | |
;; | |
*) | |
put_title "${BASH_COMMAND}" | |
;; | |
esac | |
} | |
preexec_functions+=(update_tab_command) | |
;; | |
*) | |
;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.profile: executed by the command interpreter for login shells. | |
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login | |
# exists. | |
# see /usr/share/doc/bash/examples/startup-files for examples. | |
# the files are located in the bash-doc package. | |
# the default umask is set in /etc/profile; for setting the umask | |
# for ssh logins, install and configure the libpam-umask package. | |
#umask 022 | |
#add go to path | |
export PATH=$PATH:$HOME/.go/bin | |
export GOPATH=$HOME/go | |
export PATH=$PATH:$HOME/go/bin | |
#add npm global package to path | |
export PATH=~/.npm_global/bin:$PATH | |
# if running bash | |
if [ -n "$BASH_VERSION" ]; then | |
# include .bashrc if it exists | |
if [ -f "$HOME/.bashrc" ]; then | |
. "$HOME/.bashrc" | |
fi | |
fi | |
# set PATH so it includes user's private bin if it exists | |
if [ -d "$HOME/bin" ] ; then | |
PATH="$HOME/bin:$PATH" | |
fi | |
# set PATH so it includes user's private bin if it exists | |
if [ -d "$HOME/.local/bin" ] ; then | |
PATH="$HOME/.local/bin:$PATH" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Name=DVB Inspector | |
GenericName=DVB Inspector | |
Exec=/opt/dvbinspector/dvb.sh | |
Path=/opt/dvbinspector/ | |
Terminal=false | |
Encoding=UTF-8 | |
Categories=Utility;Video; | |
Type=Application | |
Keywords=video;media |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ARCH="x64" | |
UBUNTU_VERSION="18.04" | |
GO_VERSION="1.11.2" | |
DOTNET_SDK="2.1" | |
DVB_VERSION="1.10.1" | |
update_distro(){ | |
sudo apt install software-properties-common -y && sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove -y && sudo apt-get autoclean -y | |
} | |
install_utils(){ | |
sudo apt-get install -y software-properties-gtk | |
sudo apt-get install -y htop | |
sudo apt-get install -y hwinfo | |
sudo apt-get install -y vim | |
sudo apt-get intsall -y xclip | |
sudo apt-get intsall -y net-tools | |
sudo apt-get install -y cifs-utils | |
} | |
install_git(){ | |
#add configuration and ssh keys? | |
sudo apt-get install -y git | |
} | |
install_dvb(){ | |
wget -q -O /usr/share/applications/dvbinspector.desktop https://gist.githubusercontent.com/jthomas54/1cb73fce71cd75f0243816b786ae88d1/raw/dvbinspector.desktop | |
wget -q -O "dvbinspector.zip" "https://versaweb.dl.sourceforge.net/project/dvbinspector/DVBinspector-$DVB_VERSION-dist.zip" | |
sudo mkdir /opt/dvbinspector | |
unzip dvbinspector.zip | |
sudo mv DVBinspector-$DVB_VERSION/* /opt/dvbinspector | |
rm -r DVBinspector-$DVB_VERSION | |
rm dvbinspector.zip | |
} | |
install_vscode(){ | |
wget -q -O "vscode.deb" https://go.microsoft.com/fwlink/?LinkID=760868 #Not sure is this is always the vscode link... | |
sudo apt install ./vscode.deb | |
sudo apt-get install -y apt-transport-https && sudo apt-get -y update && sudo apt-get install -y code | |
rm vscode.deb | |
} | |
install_vscode_exts(){ | |
#Have these installed depending on external file or passed through args | |
code --install-extension ms-vscode.csharp | |
code --install-extension jchannon.csharpextensions | |
code --install-extension k--kato.docomment | |
code --install-extension ms-vscode.go | |
code --install-extension sburg.vscode-javascript-booster | |
code --install-extension octref.vetur | |
code --install-extension dbaeumer.vscode-eslint | |
code --install-extension redhat.vscode-yaml | |
code --install-extension k--kato.intellij-idea-keybindings | |
code --install-extension wayou.vscode-todo-highlight | |
code --install-extension fernandoescolar.vscode-solution-explorer | |
code --install-extension tintoy.msbuild-project-tools | |
} | |
install_dotnetcore(){ | |
#INJECT LTS version | |
wget -q -O "packages-microsoft-prod.deb" "https://packages.microsoft.com/config/ubuntu/$UBUNTU_VERSION/packages-microsoft-prod.deb" | |
sudo dpkg -i ./packages-microsoft-prod.deb | |
#INJECT DOTNET CORE SDK VERSIONS | |
sudo add-apt-repository universe && sudo apt-get install -y apt-transport-https && sudo apt-get update && sudo apt-get install -y dotnet-sdk-$DOTNET_SDK | |
rm packages-microsoft-prod.deb | |
} | |
install_go(){ | |
wget -q https://storage.googleapis.com/golang/getgo/installer_linux | |
chmod +x installer_linux | |
./installer_linux | |
rm installer_linux | |
rm ~/.bash_profile | |
} | |
install_aws_tools(){ | |
sudo apt install -y awscli | |
} | |
install_node(){ | |
sudo apt-get install -y nodejs npm | |
# below allows npm packge installed without sudo or chown the /usr/local directories | |
mkdir ~/.npm_global | |
npm config set prefix '~/.npm_global' | |
} | |
install_npm_packages(){ | |
sudo npm install -g @vue/cli | |
} | |
install_docker(){ | |
sudo apt-get install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg2 \ | |
software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo apt-get update | |
sudo add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
Bionic \ | |
stable" | |
sudo apt-get install docker-ce | |
} | |
update_bash_settings(){ | |
cp ~/.bashrc ~/.bashrc.bak | |
cp ~/.profile ~/.profile.bak | |
cp ~/.bash_aliases ~/.bash_aliases.bak | |
wget -q -O ~/.bashrc https://gist.githubusercontent.com/jthomas54/1cb73fce71cd75f0243816b786ae88d1/raw/.bashrc | |
wget -q -O ~/.profile https://gist.githubusercontent.com/jthomas54/1cb73fce71cd75f0243816b786ae88d1/raw/.profile | |
wget -q -O ~/.bash_aliases https://gist.githubusercontent.com/jthomas54/1cb73fce71cd75f0243816b786ae88d1/raw/.bash_aliases | |
} | |
update_distro | |
install_utils | |
install_vscode | |
install_vscode_exts | |
install_dotnetcore | |
install_node | |
install_npm_packages | |
install_aws_tools | |
install_git | |
install_docker | |
install_dvb | |
install_touchpad_gestures | |
update_bash_settings | |
echo "TODO: Create SSH keys for github and AWS" | |
echo "TODO: Install latest nvidia drivers with `software-properties-gtk` and run `sudo prime-select intel`" | |
echo "TODO: Install java RE for dvbinspector" | |
echo "TODO: run `libinput-gestures-setup start` and `libinput-gestures-setup autostart` commands AFTER REBOOT for gesture support" | |
echo "TODO: reboot machine" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"editor.minimap.enabled": false, | |
"editor.formatOnPaste": true, | |
"editor.formatOnSave": true, | |
"files.autoSave": "afterDelay", | |
"go.autocompleteUnimportedPackages": true, | |
"go.formatTool": "gofmt", | |
"go.formatFlags": [ | |
"-s" | |
], | |
"go.useLanguageServer": true, | |
"eslint.validate": [ | |
"javascript", | |
"javascriptreact", | |
"vue" | |
], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment