Skip to content

theowenyoung/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dotfiles

Dotfiles, init scripts, etc, for now, it includes macOS, and Debian (my VPS), you shouldn't use it directly, cause it contains many personal habits, but you do can get some inspiratiions from it.

I use raw shell scripts to install apps, and YAMLScript for linking dotfiles or using template to copy template dotfile to the dest location, Keepassxc for password manager, tmux for window manager, Alacritty for terminal, helix and kakoune for modal editor. alfred for translation, calculate, launch center, workflow. navi for cheatsheets

Table of Contents

Introduction

Home Structure

├── blog
|── dotfiles
│   ├── private
├── inbox
├── repos
├── syncing

dotfiles for all env related stuffs. inbox for all temp things, like temp run repos from Github. repos for all personal repos. syncing for all other settings that does not have a decent dotfiles, but still need to backup. So if I want to reflush my sytem, I need to backup this folder.

I really

Dotfile Structure:

├── modules
│   └── zsh
│       ├── change_zsh_as_default_shell_debian.sh
│       ├── files
│       │   ├── alias_debian.zsh
│       │   ├── general_config.zsh
│       │   ├── includes
│       │   │   ├── 3_function.zsh
│       │   │   ├── 4_aliases.zsh
│       │   │   ├── 5_fzf_keybinding.zsh
│       │   │   ├── 6_fzf_completion.zsh
│       │   │   ├── 7_git_prompt.zsh
│       │   │   └── 8_ssh_zsh_completion.zsh
│       │   ├── global.zsh
│       │   ├── path_ubuntu.zsh
│       │   └── zshrc.zsh
│       ├── install_zsh_debian.sh
│       └── zsh.yml
├── private
│   ├── keepassxc
│   │   ├── dev.kdbx
│   │   ├── high.kdbx
│   │   └── main.kdbx
│   ├── ssh
│   │   ├── files
│   │   │   ├── config
│   │   │   └── id_ed25519.pub
│   │   └── ssh.yml
└── scripts
    ├── 0_install_pre_required_modules_for_debian.sh
    ├── 0_install_pre_required_modules_for_macos.sh
    ├── 1_configure_macos.sh
    ├── 1_install_required_modules_for_debian.sh
    ├── 2_import_dotfiles_debian.sh
    ├── 2_install_required_modules_macos.sh
    ├── 3_import_dotfiles_macos.sh
    ├── 4_install_modules_macos.sh
    ├── import_ssh_key.sh
    ├── import_temp_env.sh
    ├── link.sh
    ├── test.sh
    └── unlink.sh

modules for all apps, every app should contains an install script, and optional files folder, and app.ys.yml for YAMLScript.

private for private data, I sync it to a github private repo, inlucde keepassxc encrypted file, and other personal file. Though it's a individual repo, I still clone it in dotfiles folder, and ignore it in .gitignore, cause it's convenient to apply changes.

scripts for common shell script, so ideally, I can use a few script to bootstrap my new environment.

Common Commands

  1. make link: link or copy all dotfiles to the right place
  2. make unlink: unlink all things.
  3. make backup: backup qBittorrent.conf to dotfiles source, cause you may change the qbittorrent settings from web ui, and qBittorrent run with podman, the qBittorrent.conf file permission does not allow to link.
  4. li: short for ./scripts/link.sh,but a lot convinience, for example: li for apply current module's dotfiles. li all, apply all. li module_name, apply module's dotfiles whatever your current work direction.

MacOS Init

0. Install xcode command line tools

xcode-select --install

1. Clone dotfiles repo and private dotfiles repo

first we will use the git https url, then we settle sshkey down, we'll change it to ssh url.

git clone https://github.com/theowenyoung/dotfiles.git ~/dotfiles

Then, clone the private repo, should get github personal_token first, private will be placed in ~/dotfiles, considered more convinient.

cd dotfiles
git clone https://theowenyoung:<token>@github.com/theowenyoung/private.git ~/dotfiles/private

2. Config macos

./modules/macos/configure_macos.sh

3. Install required apps

./scripts/2_install_required_modules_macos.sh

4. Import Dotfiles

./scripts/3_import_dotfiles_macos.sh
source ~/.zshrc

5. Install Other Apps You need by shell

cd ~/dotfiles
./modules/foo/install_foo_macos.sh

6. Resort pre-installed Apps

Move Terminal, Activity Monitor, Quick Time Player to the top. Move anything that Don't need to the Other Folder.

7. Add Input Source if needed

Settings -> Keyboard -> Input Sources

8. Addition settings

Settings -> Keyboard -> Shortcuts

open alacritty.app -> hyper+a
open keepassxc -> hyper+p
open mail -> hyper+m
open edge -> hyper+e
open system preferences -> hyper+s
open vscode -> hyper+v

Deiban Init

ssh to the machine(force use password, consider it's a new machine):

ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no root@ip

0. Install Pre Required Modules

This should be run as root:

# sudo su - root
wget -qO- https://dotfiles.owenyoung.com/scripts/0_install_pre_required_modules_for_debian.sh | bash

or, if you need to create normal user:

wget -qO- https://dotfiles.owenyoung.com/scripts/0_install_pre_required_modules_for_debian.sh | bash -s -- --create

This will install keepassxc,git,zsh,curl,build-essential and create normal user green with sudo privileges.

2. Clone dotfiles repo and private dotfiles repo

first we will use the git https url, then we settle sshkey down, we'll change it to ssh url.

git clone https://github.com/theowenyoung/dotfiles.git ~/dotfiles

Then, clone the private repo, should get github personal_token first, private will be placed in ~/dotfiles, considered more convinient.

git clone https://theowenyoung:<token>@github.com/theowenyoung/private.git ~/dotfiles/private

2.1 Install clash for proxy if needed

./root/clash/install_clash_premium_debian.sh

3. Install required Apps

cd ~/dotfiles
# first unlink all things
./scripts/unlink.sh
./scripts/1_install_required_modules_for_debian.sh
source ~/.zshrc

4.Import dotfiles

./scripts/2_import_dotfiles_debian.sh

5. Change sshd config(only once)

INIT=true ./scripts/link.sh sshd

Apps Notes

Keepassxc

Password Manager

# high level password
high.kdbx
# most password
main.kdbx
# dev related password, like api token, personal token.
dev.kdbx

Alfred

Alfred config is so messed, so I make the alfred syncing folder to ~/syncing/alfred, then mamual to set it up.

Hot Key: Disable system Hot Key: Spotlight Hot Key, in Keyboard shortcut settings.

iterm2

Also, the other alternative like alacritty or wezterm, they have their own problem. iterm2 still is the most convinient one.

Gruvbox theme: https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/master/schemes/Gruvbox%20Dark.itermcolors Option -> Esc+ Startup style: Full Screen

Terminal

Gruvbox theme: https://github.com/morhetz/gruvbox-contrib/blob/master/osx-terminal/Gruvbox-dark.terminal Option as meta Window Size: 300 100

Workflows

Manual Download
Shell Scripts
./modules/alfred/install_alfred_workflows.sh

This will install the following workflows:

QMK

See qmk readme

Oracle Cloud Init

It sucks of oracle cloud security rules, see question to enable oracle cloud access.

You need to manual open port:

sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 80 -j ACCEPT
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 443 -j ACCEPT
sudo netfilter-persistent save

debian disable sleep when display is off

sudo vi /etc/systemd/logind.conf
HandleLidSwitch=ignore
sudo systemctl restart systemd-logind

Traceroute with ip info

./scripts/traceroute.sh <ip>

Open BBR

current:

sysctl net.ipv4.tcp_available_congestion_control

aws linux:

sudo modprobe tcp_bbr
sudo modprobe sch_fq
sudo sysctl -w net.ipv4.tcp_congestion_control=bbr

forever:

echo "tcp_bbr" | sudo tee -a /etc/modules-load.d/modules.conf
echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
sysctl net.ipv4.tcp_congestion_control

Apps

Resource