Skip to content

Commit

Permalink
cleanup and better android install experience
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxWolf-01 committed Nov 26, 2024
1 parent fa0e46c commit 8a75bf7
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 166 deletions.
66 changes: 24 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ I use these dotfiles for my daily driver Ubuntu and Android setup, as well as pr
### Overview

If you plan on cloning / forking this repo, be aware that all config is tailored to me (e.g. paths, usernames, ...) and make sure to change .gitconfig to your name and email.
But if you're starting from scratch anyway (_which I recommend_, in order to become fammiliar with the functionality bit
by bit).
But if you're starting from scratch anyway (_which I recommend_, in order to become fammiliar with the functionality bit by bit).
Since these dotfiles are tailored specifically to me, your needs and preferences will be different and I would recommend you just copy the bits and pieces you need.

```bash
Expand Down Expand Up @@ -45,78 +44,61 @@ sudo apt autoremove && sudo apt clean
</details>

Pre-requisites:

```bash
sudo apt-get update && sudo apt-get install -y git gh
gh auth login
```

```bash
cd ~ && git clone git@github.com:MaxWolf-01/dotfiles.git
# or
cd ~ && git clone --depth 1 git@github.com:MaxWolf-01/dotfiles.git
```

```bash
mv dotfiles .dotfiles && cd ~/.dotfiles && ./install
mv dotfiles .dotfiles && cd ~/.dotfiles && ./install && ./setup minimal
```
or for a more complete setup use `./setup cli` or `./setup ubuntu`.

*open new shell* (or reboot when in doubt)

Optional next steps:

Run ``./setup all`` to install packages, plugins, themes, ...
Works on Ubuntu.
Run ``./setup minimal`` for an unbloated setup with essential cli tools and a minimal zsh setup on any system.
For more/specific setups, check out `setup`.

```./install``` is idempotent, so you can run it multiple times without breaking anything, i.e. after pulling new
changes, which will update the symlinks etc.
But make sure to export your gnome keyboard shortcuts via `./bin/keybindings.pl` before you execute the script,
otherwise they
get overwritten by mine.
`./install` and most functions in `setup` are idempotent, so you can run it multiple times without breaking anything, i.e. after pulling new changes, which will update the symlinks etc.
But make sure to export your gnome keyboard shortcuts via `./bin/keybindings.pl` before you execute the script, otherwise they get overwritten by mine.

### Setup (Android)

Download and install [termux](https://github.com/termux/termux-app#github)
apk [from f-droid](https://f-droid.org/en/packages/com.termux/).
Don't worry about warnings from `termux-setup-storage` about deleting all your data. *Should* be fine.
``~/storage/shared`` in your termux home
directory [is symlinked](https://android.stackexchange.com/a/185949) ``/storage/emulated/0`` (where downloads folder
etc. are on Android)

Download and install [termux](https://github.com/termux/termux-app)
apk [from f-droid](https://f-droid.org/en/packages/com.termux/), then:
```bash
export DEBIAN_FRONTEND=noninteractive
termux-setup-storage
pkg update && pkg upgrade && pkg install git
cd /data/data/com.termux/files/home && git clone --depth 1 https://github.com/MaxWolf-01/dotfiles.git
mv dotfiles .dotfiles && cd ~/.dotfiles && ./install
./setup android
mv dotfiles .dotfiles && cd ~/.dotfiles && ./install && ./setup android
```
Don't worry about warnings from `termux-setup-storage` about deleting all your data. *Should* be fine.
`~/storage/shared` in your termux home directory [is symlinked](https://android.stackexchange.com/a/185949) `/storage/emulated/0` (where downloads folder etc. are on Android).

``./setup android`` will install essential packages and setup up [**Obsidian**](https://obsidian.md/).
`./setup android` will install essential packages and sets up [**Obsidian**](https://obsidian.md/):
An "obsidian" folder will be created in the android home directory.
To automatically commit, pull and push, run ``sync``.
Aliases for android specifically are in [zsh/android](https://github.com/MaxWolf-01/dotfiles/tree/master/zsh/android).
Make sure to always sync before and after you work on one of them, or you'll need to deal with merge conflicts.
To automatically commit, pull and push, run `sync`.
Other aliases for android specifically are in [zsh/android](https://github.com/MaxWolf-01/dotfiles/tree/master/zsh/android).
Scripts for pushing conflicts to deal with them in an IDE and fixing occasional corrupt git objects are in `bin`.

### What's in it?

**Functions**

- ``o`` (open file explorer or the file given as argument)
- ``mcd`` (make directory and cd into it)
- ``targz`` (create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression)
- ``extract`` (extracts archived files / mounts disk images)
- ``fs`` (determine size of a file or total size of a directory)
- ``lsfs`` (list n largest files and folder in a directory, recursively; smallest if n is negative; n defaults to 10)
- ``gz`` (compare original and gzipped file size)
- ``tre`` (`tre` is a shorthand for `tree` with hidden files and color enabled, ignoring the `.git` directory, listing
- `o` (open file explorer or the file given as argument)
- `mcd` (make directory and cd into it)
- `targz` (create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression)
- `extract` (extracts archived files / mounts disk images)
- `fs` (determine size of a file or total size of a directory)
- `lsfs` (list n largest files and folder in a directory, recursively; smallest if n is negative; n defaults to 10)
- `gz` (compare original and gzipped file size)
- `tre` (`tre` is a shorthand for `tree` with hidden files and color enabled, ignoring the `.git` directory, listing
directories first.)
- ``newsshpwd`` (change the ssh passphrase of given key)
- ``numel`` (number of elements in folder)
- ``archive_md` (archive websites as markdown using [dhravya/markdowner](https://github.com/dhravya/markdowner)
- `newsshpwd`` (change the ssh passphrase of given key)
- `numel`` (number of elements in folder)
- `archive_md` (archive websites as markdown using [dhravya/markdowner](https://github.com/dhravya/markdowner)
- and many more ... (see functions / aliases in [zsh folder](https://github.com/MaxWolf-01/dotfiles/tree/master/zsh))

Various **scripts**, such as gnome keyboard shortcut backup/restore, laptop battery limiter, backup scripts, nightlight
Expand Down
8 changes: 4 additions & 4 deletions install.conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

- shell:
- [ git submodule update --init --recursive, Installing submodules ]
- command: bash setup cli
description: Setting up zsh and installing packages
stdout: true
stderr: true
# - command: bash setup minimal
# description: Setting up zsh and installing packages
# stdout: true
# stderr: true
175 changes: 72 additions & 103 deletions setup
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
#!/bin/bash

all() { # doesn't include repos
cli
desktop
tools
apps
}

repos() { # idempotently clones personal / work repos
obsidian_vault
}

apps() {
minimal() {
# install minimal cli tools
sudo apt-get update
sudo apt-get install -y \
baobab \
blueman \
gnome-shell-extensions-gpaste \
gparted \
pulseaudio-module-bluetooth
toolbox
signal
}
curl \
git \
ssh \
tree \
vim \
zsh

zsh zsh/plugin-files/zap_zsh_install # minimal zsh plugin manager
sudo chsh -s "$(which zsh)" "$USER" # set zsh as default shell

tools() {
docker
miniconda
mamba
tinygrad
act
get_restic
fuzzy_finder

sudo mkdir -p /usr/local/bin
sudo ln -s ~/bin/* /usr/local/bin/
}

cli() {
Expand All @@ -56,9 +44,7 @@ cli() {
zsh zsh/plugin-files/zap_zsh_install # minimal zsh plugin manager
sudo chsh -s "$(which zsh)" "$USER" # set zsh as default shell

# fuzzy finder
if [ ! -d "$HOME/.fzf" ]; then git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf; fi;
cd ~/.fzf && git pull && ~/.fzf/install
fuzzy_finder

# terminal theme
curl -sSL "https://github.com/zthxxx/jovial/raw/master/jovial.zsh-theme" -o ~/.dotfiles/zsh/plugin-files/mytheme.zsh-theme
Expand All @@ -83,33 +69,64 @@ cli() {
nvim

touch ~/.local_exports
}

ubuntu() {
cli
sudo apt-get install -y \
baobab \
blueman \
gnome-shell-extensions-gpaste \
gparted \
pulseaudio-module-bluetooth \
virt-viewer

./bin/keybindings.pl -i

# disable screenshot sound
if [ -f "/usr/share/sounds/freedesktop/stereo/camera-shutter.oga" ]; then
sudo mv /usr/share/sounds/freedesktop/stereo/camera-shutter.oga /usr/share/sounds/freedesktop/stereo/camera-shutter-disabled.oga
fi

### remove bloat
# screen reader
sudo apt-get remove -y orca
# braille display driver
sudo apt-get remove -y brltty
# webp support for eye of gnome image viewer
# yes | sudo add-apt-repository ppa:helkaluin/webp-pixbuf-loader (ships with >=22.04)
sudo apt install webp-pixbuf-loader
xdg-mime default org.gnome.eog.desktop image/webp

# encrypted volumes
yes | sudo add-apt-repository ppa:unit193/encryption
sudo apt-get update
sudo apt-get install -y veracrypt

obsidian
obsidian_vault
syncthing

### remove bloat
# screen reader
sudo apt-get remove -y orca
# braille display driver
sudo apt-get remove -y brltty
}

desktop() {
sudo apt-get install -y virt-viewer
android() {
pkg update && pkg upgrade
pkg install python gh fastfetch git-lfs zsh vim htop
git lfs install
gh auth login

./bin/keybindings.pl -i
vault_dir=~/storage/shared/obsidian # https://android.stackexchange.com/a/185949
mkdir -pv $vault_dir
cd $vault_dir && git clone --depth 1 https://github.com/MaxWolf-01/knowledge-base
cd knowledge-base && git clone --depth 1 https://github.com/MaxWolf-01/.obsidian && ./switch_platform.sh mobile
git config --global --add safe.directory /storage/emulated/0/obsidian/knowledge-base

# disable screenshot sound
if [ -f "/usr/share/sounds/freedesktop/stereo/camera-shutter.oga" ]; then
sudo mv /usr/share/sounds/freedesktop/stereo/camera-shutter.oga /usr/share/sounds/freedesktop/stereo/camera-shutter-disabled.oga
fi
zsh zsh/plugin-files/zap_zsh_install # minimal zsh plugin manager
chsh -s zsh # set zsh as default shell

# webp support for eye of gnome image viewer
# yes | sudo add-apt-repository ppa:helkaluin/webp-pixbuf-loader (ships with >=22.04)
sudo apt install webp-pixbuf-loader
xdg-mime default org.gnome.eog.desktop image/webp
fuzzy_finder

# encrypted volumes
yes | sudo add-apt-repository ppa:unit193/encryption
sudo apt-get update
sudo apt-get install -y veracrypt
echo "source ~/.dotfiles/zsh/android" >> ~/.zshrc
}

docker() {
Expand All @@ -120,6 +137,11 @@ docker() {
echo "Reboot to apply changes"
}

fuzzy_finder() {
if [ ! -d "$HOME/.fzf" ]; then git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf; fi;
cd ~/.fzf && git pull && ~/.fzf/install
}

miniconda() {
mkdir -p ~/miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
Expand All @@ -136,17 +158,6 @@ mamba() {
conda config --append envs_dirs ~/miniconda3/envs/
}

tinygrad() {
mamba env list | grep 'tinygrad' >/dev/null 2>&1 || mamba create -n tinygrad
source "$HOME/miniforge3/bin/activate" tinygrad # https://askubuntu.com/a/1464306
cd "$HOME/repos/tools"
if [ -d "tinygrad" ]; then cd tinygrad && git pull; else git clone https://github.com/tinygrad/tinygrad.git && cd tinygrad ; fi;
python -m pip install -e .
python -m pip install -e '.[testing]'
# for visualizing the computation graph
sudo apt install -y graphviz
pip install pydot
}

nvim() {
local appimage_url="https://github.com/neovim/neovim/releases/latest/download/nvim.appimage"
Expand Down Expand Up @@ -178,48 +189,6 @@ get_restic() {
echo "to schedule backup:\nsudo -e /etc/anacrontab\n7 7 $HOME/.dotfiles/bin/restic_backup $HOME/backup/restic_repos/<XXX> $HOME/.dotfiles/secrets/passwords/restic_<XXX>"
}

android() {
pkg update && pkg upgrade
pkg install python gh fastfetch git-lfs
git lfs install
gh auth login

vault_dir=~/storage/shared/obsidian # https://android.stackexchange.com/a/185949
mkdir -pv $vault_dir
cd $vault_dir && git clone --depth 1 https://github.com/MaxWolf-01/knowledge-base
cd knowledge-base && git clone --depth 1 https://github.com/MaxWolf-01/.obsidian && ./switch_platform.sh mobile

echo "source ~/.dotfiles/zsh/android" >> ~/.zshrc
}

minimal() {
# install minimal cli tools for any system
sudo apt-get update
sudo apt-get install -y \
curl \
git \
make \
ripgrep \
ssh \
tree \
vim \
zsh

zsh zsh/plugin-files/zap_zsh_install # minimal zsh plugin manager
sudo chsh -s "$(which zsh)" "$USER" # set zsh as default shell

# fuzzy finder
if [ ! -d "$HOME/.fzf" ]; then git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf; fi;
cd ~/.fzf && git pull && ~/.fzf/install

# terminal theme
curl -sSL "https://github.com/zthxxx/jovial/raw/master/jovial.zsh-theme" -o ~/.dotfiles/zsh/plugin-files/mytheme.zsh-theme
pip3 install --usesr pywal

sudo mkdir -p /usr/local/bin
sudo ln -s ~/bin/* /usr/local/bin/
}

### functions below this line are not included in `all` and should be run manually / if needed

secrets() {
Expand Down
17 changes: 0 additions & 17 deletions vim/vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,3 @@ set tabstop=4
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab

" Uses H and L To navigate between blank lines in Visual and Normal modes.
noremap H {
noremap L }
" Uses K and J to scroll back and forth in Visual and Normal modes
noremap K <C-b>
noremap J <C-f>

call plug#begin('~/.vim/plugged')

" TODO change Ctrl+n to alt+j https://www.reddit.com/r/neovim/comments/17dcy9i/plugin_or_command_for_simultaneous_nonadjacent/
Plug 'mg979/vim-visual-multi', {'branch': 'master'}

call plug#end()

0 comments on commit 8a75bf7

Please sign in to comment.