Skip to content

Instantly share code, notes, and snippets.

@pongstr
Last active January 17, 2024 20:28
Show Gist options
  • Save pongstr/0759962a1cab71d73c15fde262e6f8b0 to your computer and use it in GitHub Desktop.
Save pongstr/0759962a1cab71d73c15fde262e6f8b0 to your computer and use it in GitHub Desktop.
Debian Stuff
#!/bin/bash
# Set sources
echo '
## deb cdrom:[Debian GNU/Linux bullseye-DI-rc2 _Bullseye_ - Official Snapshot amd64 NETINST 20210607-15:56]/ bullseye main
## deb cdrom:[Debian GNU/Linux bullseye-DI-rc2 _Bullseye_ - Official Snapshot amd64 NETINST 20210607-15:56]/ focal main restricted
deb https://deb.debian.org/debian/ bullseye main contrib non-free
deb-src https://deb.debian.org/debian/ bullseye main contrib non-free
deb https://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free
deb https://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src https://deb.debian.org/debian bullseye-updates main contrib non-free
deb https://deb.debian.org/debian bullseye-backports main contrib non-free
deb-src https://deb.debian.org/debian bullseye-backports main contrib non-free
' > /etc/apt/sources.list
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget git \
nvidia-drivers firmware-iwlwifi firmware-linux-free \
firmware-linux-nonfree firmware-linux firmware-misc-nonfree \
build-essential make g++ gcc nginx dnsmasq libnss3-tools resolvconf \
apt-transport-https apt-transport-https ca-certificates curl \
gnupg lsb- htop ufw sudo neofetch tree ranger ssh bash-completion \
terminator tree unzip vim zsh
## Install OhMyZSH
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
## WebDev: Nodenv + Nodejs + Yarn
git clone https://github.com/nodenv/nodenv.git $HOME/.nodenv
echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> $HOME/.zshrc
$HOME/.nodenv/bin/nodenv init source $HOME/.zshrc
## create plugins directory
mkdir -p "$(nodenv root)"/plugins
## install must-have plugins
git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
git clone https://github.com/nodenv/nodenv-update.git "$(nodenv root)"/plugins/nodenv-update
git clone https://github.com/nodenv/node-build-update-defs.git "$(nodenv root)"/plugins/node-build-update-defs
## Install Kinto.sh (Mac-style shortcut keys for linux+windows)
/bin/bash -c "$(wget -qO- https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh || curl -fsSL https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh)"
# Install Vscode
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
sudo apt install -y code
## Install Firefox (non-esr)
curl -L -o /tmp/firefox-stable.tar.bz2 https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US
sudo tar -C /opt -xvf /tmp/firefox.tar.bz2 && rm -rf /tmp/firefox.tar.bz2
sudo touch /usr/share/applications/firefox.desktop
sudo echo '[Desktop Entry]
Name=Firefox Stable
Comment=Web Browser
Exec=/opt/firefox/firefox %u
Terminal=false
Type=Application
Icon=/opt/firefox/browser/chrome/icons/default/default128.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true' > /usr/share/applications/firefox.desktop
## Install Brave Browser
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt update && sudo apt install -y brave-browser
## Install Spotify
curl -sS https://download.spotify.com/debian/pubkey_0D811D58.gpg | sudo apt-key add -
echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt update && sudo apt install -y spotify-client
## Restart Bluetooth Service
## it's a little janky
sudo systemctl stop bluetooth.service
sleep 1
sudo systemctl start bluetooth.service
#!/bin/zsh
echo "
Install Terminator Setup+Settings+Theme"
ln -sf $HOME/configs/terminator $HOME/.config/terminator
echo "
Install Vim Setup+Settings+Theme"
ln -sf $HOME/configs/vim/.vimrc $HOME/.vimrc
ln -sf $HOME/configs/vim/.vim $HOME/.vim
echo "
Install OhMyZsh Theme"
ln -sf $HOME/configs/pongstr.zsh-theme $HOME/.oh-my-zsh/themes/pongstr.zsh-theme
echo "
Install WebDev local webdev certs"
sudo cp -R $HOME/configs/ca-certificates /usr/share/ca-certificates/pongstr
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," \
-n "Node" \
-i /usr/share/ca-certificates/pongstr/node.test_CA.pem
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," \
-n "Vue" \
-i /usr/share/ca-certificates/pongstr/vue.test_CA.pem
sudo echo '
listen-address=127.0.0.1
address=/test/127.0.0.1
' > /etc/dnsmasq.d/test.conf
echo "
Install Nginx Config"
sudo ln -sf $HOME/config/nginx/nginx.conf /etc/nginx/nginx.conf
sudo systemctl start dnsmasq.service
sudo systemctl start nginx.service
sudo systemctl start resolvconf

Install Nvidia Driver

After Debian (Buster) install, VGA is not detected or recognnize for some reason. Updating Nviida driver resolves the issue.

## file: /etc/apt/source.list

deb http://deb.debian.org/debian/ buster-backports main contrib non-free
deb-src http://deb.debian.org/debian/ buster-backports main contrib non-free

deb http://security.debian.org/debian-security buster/updates main contrib
deb-src http://security.debian.org/debian-security buster/updates main contrib

# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main contrib
deb-src http://deb.debian.org/debian/ buster-updates main contrib

once done, update aptitude and install nvidia drivers.

$ sudo apt update 
$ sudo apt install nvidia-driver

## if you need to login right away
$ sudo startx

## Otherwise, just reboot the machine for drivers 
## to take effet and you can have nice resolution
$ sudo reboot

Git

## To get the latest version, add the PPA repo or
## install from source. Default package from debian
## might not be up-to-date.
$ sudo apt install git

## Set your git config
$ git config --global user.name $USER
$ git config --global user.email $EMAIL

## Additionally, add you SSH keys after this step

Zsh (Git is a prerequisite)

## Install ZSH
$ sudo apt install zsh 

## Install OhMyZsh
$ sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Setup Vim

## If not installed yet
$ sudo apt install vim

## Customize Vim
$ mkdir -p .vim/{backup,colors,plugins,swaps,undo}

## Download+Install vim stuff
$ curl -o ~/.vim/.viminfo https://raw.githubusercontent.com/pongstr/dotfiles/master/.vim/.viminfo
$ curl -o ~/.vim/colors/pongstr.vim https://raw.githubusercontent.com/pongstr/dotfiles/master/.vim/colors/pongstr.vim
$ curl -o ~/.vimrc https://raw.githubusercontent.com/pongstr/dotfiles/master/.vimrc

Nodenv + Nodejs

The instructions below might get updated, best is to follow the one on the official repo

## Clone the project
$ git clone https://github.com/nodenv/nodenv.git ~/.nodenv

## Export PATH
$ echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.zshrc
$ ~/.nodenv/bin/nodenv init

## invoke source just for the current session
## to recognize the recent changes
$ source ~/.zshrc

## Run the doctor to validate whether
## we did well
$ curl -fsSL https://github.com/nodenv/nodenv-installer/raw/master/bin/nodenv-doctor | bash

## Install must-have plugins 
$ mkdir -p "$(nodenv root)"/plugins

## `node-build` + `nodenv-update`
$ git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
$ git clone https://github.com/nodenv/nodenv-update.git "$(nodenv root)"/plugins/nodenv-update
$ git clone https://github.com/nodenv/node-build-update-defs.git "$(nodenv root)"/plugins/node-build-update-defs

dnsmasq + nginx

## Install first
$ sudo apt install dnsmasq nginx

## Configure dnsmasq via NetworkManager
## append/insert the line below, save and quit with `:wq!`
## listen-address=127.0.0.1
## address=/test/127.0.0.1
$ sudo -E vi /etc/dnsmasq.conf

## Either start or restart `dnsmasq.service`
$ sudo systemctl restart dnsmasq.service

## Validate
$ dig example.test

At this point you may configure your nginx however you want, create sites and server_name suffixing it with .test

If you're utilzing SSL for development, do the steps below for your browsers to trust you self-signed certificate.

## Install these if you haven't
$ sudo apt install ca-certificates libnss3-tools

Before anything, generate a self-signed certificate and place it to /usr/share/ca-certificates/${path}/ and update.

$ sudo update-ca-certificates

Add the certificate, ensure that -n "My Homemade CA" has o be unique everytime.

$ certutil -d sql:$HOME/.pki/nssdb -A -t "C,," \
  -n "My Homemade CA" \
  -i /usr/share/ca-certificates/webdev/${YOUR_CERT}.pem
  
## You may logout or what not, it's easier to reboot 
## for changes to take effect, I guess
$ sudo reboot

Steam on AMD64

## Install 32bit layer
$ sudo dpkg --add-architecture i386

## Verify Installation
$ sudo dpkg --print-foreign-architectures

## Install nvidia drivers to run steam
$ sudo apt-get install libgl1-nvidia-glvnd-glx:i386

## Install Steam
$ sudo apt-get install steam

Docker

Official Guide for Debian

## Issue:
$ Cannot start service airport: cgroups: cgroup mountpoint does not exist: unknown

## Fix:
$ sudo mkdir /sys/fs/cgroup/systemd && sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd

Chrome

Force Chrome to use darkmode gui to its internal pages:

# Edit the launcher file
sudo -E vi /opt/google/chrome/google-chrome

# Append these flags: --enable-features=WebUIDarkMode --force-dark-mode
# to this line:
exec -a "$0" "$HERE/chrome" "$@" 

# where final output should look like this
exec -a "$0" "$HERE/chrome" "$@" --enable-features=WebUIDarkMode --force-dark-mode

Keychron K1 (MacOS keyboard)

A better Linux & Windows keyboard layout for professional mac users

Bluetooth

# When using GDM, another instance of PulseAudio is started, 
# which “captures” your bluetooth device connection. 
# This can be prevented by masking the pulseaudio socket 
# for the GDM user by doing the following:
mkdir -p ~gdm/.config/systemd/user
ln -s /dev/null ~gdm/.config/systemd/user/pulseaudio.socket

Electron Apps

https://stackoverflow.com/a/69087954

## unpack package
dpkg-deb -x slack-desktop-4.19.2-amd64.deb unpack

## extract cpntrol files?
dpkg-deb --control slack-desktop-4.19.2-amd64.deb


## move `DEBIAN` into the `unpack` folder
mv DEBIAN unpack


Open the file ./unpack/DEBIAN/control and 

## open the `control` file and replace 
##`libappindicator3-1` with `libayatana-appindicator3-1`
vi ./unpack/DEBIAN/control


## Re-package the archive and try installing again
dpkg -b unpack slack.deb

## try to install the app again
sudo apt install ./slack.deb
sudo apt install \
build-essential \
curl \
libbz2-dev \
libffi-dev \
liblzma-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxmlsec1-dev \
llvm \
make \
tk-dev \
wget \
xz-utils \
zlib1g-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment