Skip to content

Instantly share code, notes, and snippets.

@m-e-h
Last active October 22, 2022 19:15
Show Gist options
  • Save m-e-h/f890b3d5b6ed95138eb11dca83f31748 to your computer and use it in GitHub Desktop.
Save m-e-h/f890b3d5b6ed95138eb11dca83f31748 to your computer and use it in GitHub Desktop.
Linux(Ubuntu) Fresh Install
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/home/marty/.oh-my-zsh"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status custom_meh dir vcs)
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_CUSTOM_MEH="echo '\uf11a' meh"
POWERLEVEL9K_CUSTOM_MEH_FOREGROUND="black"
POWERLEVEL9K_CUSTOM_MEH_BACKGROUND="white"
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=""
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="\uf155 "
POWERLEVEL9K_MODE='nerdfont-complete'
POWERLEVEL9K_DISABLE_RPROMPT=true
# https://github.com/zeit/zeit.zsh-theme
# ZSH_THEME="zeit"
ZSH_THEME="powerlevel9k/powerlevel9k"
COMPLETION_WAITING_DOTS="true"
plugins=(
git
zsh-syntax-highlighting
command-not-found
ubuntu
npm
yarn-autocompletions
colorize
)
source $ZSH/oh-my-zsh.sh
export PATH=~/.local/share/umake/bin:~/node_modules/.bin:~/wpcs:~/dotfiles/wpcs:~/.config/composer:~/.config/composer/vendor/bin:/snap/bin:/snap/node:$PATH
function vup
{
cd $HOME/vagrant-local
vagrant up
}
function appup
{
sudo apt update && sudo apt upgrade && sudo snap refresh && flatpak update
}
# node.js
alias nodejs=node
# git
alias g="git"
alias gs="git status"
alias gd="git diff"
alias gc="git commit"
alias gch="git checkout"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
#!/bin/bash
# Check existing packages up to date
apt update
apt upgrade
# Basic apt commands
apt -y install software-properties-common
apt -y install wget
apt -y install curl
apt -y install php
apt -y install php-cli
apt -y install php-pear
# Installing Programs
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
add-apt-repository -y ppa:lyzardking/ubuntu-make
add-apt-repository -y ppa:alexlarsson/flatpak
apt update
# syncthing
apt -y install syncthing
# ubuntu make
apt -y install ubuntu-make
umake web firefox-dev
# Snaps
apt -y install snapd
snap login YOUR_EMAIL
snap install libreoffice
snap install gimp
snap install inkscape
snap install vlc
snap install simplenote
snap install wordpress-desktop
snap install --classic atom
snap install node --classic --channel=10
# Flatpak
apt -y install flatpak
apt -y install gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub com.uploadedlobster.peek
flatpak install flathub org.filezillaproject.Filezilla -y
# git
apt -y install git
git config --global user.name "YOUR_USER"
git config --global user.email YOUR_EMAIL
# cleanup
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
ln -s -f /snap/bin/node /usr/bin/nodejs
# zsh
apt -y install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sudo chsh -s $(which zsh) $(whoami)
# composer
EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('SHA384', 'composer-setup.php');")"
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
mv composer.phar .config/composer/composer

Use the dist-packaged apps

sudo apt install git php php-cli php-pear curl zsh

Snaps

sudo apt install snapd
sudo snap login YOUR_EMAIL

snap install chromium docker gimp simplenote wavebox wordpress-desktop

snap install libreoffice
snap install gimp
snap install inkscape
snap install vlc
snap install simplenote
snap install wordpress-desktop
snap install --classic atom

Flatpak

sudo add-apt-repository ppa:alexlarsson/flatpak
sudo apt update
sudo apt install flatpak

sudo apt install gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub com.uploadedlobster.peek
flatpak install flathub org.filezillaproject.Filezilla -y

git

git config --global user.name "YOUR_USER"
git config --global user.email YOUR_EMAIL

SSH Keys

ssh-keygen -t rsa -C "YOUR_EMAIL"
ssh-add ~/.ssh/id_rsa

sudo apt-get install xclip
xclip -sel clip < ~/.ssh/id_rsa.pub

then paste into github settings.

node.js

nodejs as a snap

sudo snap install node --classic --channel=10

to switch node versions...

sudo snap refresh node --channel=9

Ubuntu sometimes looks for nodejs instead of node. Let's make a symlink.

sudo rm /usr/bin/nodejs
sudo ln -s /snap/bin/node /usr/bin/nodejs

Correct the node path

npm config set scripts-prepend-node-path true

ZSH

Install Oh-My-ZSH

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Set ZSH as the default shell

sudo chsh -s $(which zsh) $(whoami)

Composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Make Global

sudo mv composer.phar /usr/local/bin/composer

PHP CodeSniffer

composer global require "squizlabs/php_codesniffer=*"

WordPress Coding Standards

git clone -b master https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs

Add its path to PHPCS configuration

phpcs --config-set installed_paths /home/marty/dotfiles/wpcs

check

phpcs -i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment