Skip to content

Commit

Permalink
unify branches - merge PR #2
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxWolf-01 authored Apr 11, 2024
2 parents be50d1a + def08e6 commit dec6028
Show file tree
Hide file tree
Showing 35 changed files with 1,417 additions and 199 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ on:
push:
branches:
- master
- ubuntu
- proxmox
- lxc
- android

paths-ignore:
- '**/*.md'
- '.gitignore'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ bin
*.zsh-theme
*TODO*
*todo*
secrets
47 changes: 0 additions & 47 deletions Makefile

This file was deleted.

136 changes: 81 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,97 @@
# Dotfiles
# Linux Dotfiles

### Overview

All the common config is in the [master](https://github.com/MaxWolf-01/dotfiles/tree/master) branch.
As of now I also have os specific configs for
[ubuntu](https://github.com/MaxWolf-01/dotfiles/tree/ubuntu),
[proxmox](https://github.com/MaxWolf-01/dotfiles/tree/proxmox),
[lxc(minimal)](https://github.com/MaxWolf-01/dotfiles/tree/lxc) and
[android](https://github.com/MaxWolf-01/dotfiles/tree/android) with specific installation instructions and dotfiles tailored for the platform (e.g.: android, an unbloated bootstrap script for small containers, ...).
The master branch only serves as a base / for structure and the public Readme.
**For the latest, fully fledged config, take a look at the ubuntu branch, since this is the one I use on a daily basis.**
I use these dotfiles for my daily driver Ubuntu and Android setup, as well as proxmox and LXCs.

If you plan on cloning / forking this repo, **make sure to change the github user information in gitconfig**.
But if you're starting from scratch anyway (_which I recommend_, in order to become fammiliar with the functionality bit by bit and since these dotfiles are tailored specifically to me, your needs will be different), I would recommend you don't fork the repo but just copy the bits and pieces you need.
### Overview

##### Structure
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).
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
dotfiles
├── bin # custom scripts
├── desktop # ubuntu specifc: desktop shortcuts, icons
├── [dotbot](https://github.com/anishathalye/dotbot)
├── git # git config mapt to ~/.gitconig, ...
├── git # git config maps to ~/.gitconig, ...
├── ssh # ssh config maps to ~/.ssh
├── vim # vim config
├── secrets # priv. & encrypted repo (see git/hooks & setup secrets)
├── zsh
│ ├── plugin-files # place for plugin / theme scripts
│ ├── aliases # aliases for zsh, git, ...
│ ├── colors # colors for filetypes in shell
│ ├── exports # env vars and path configs
│ ├── functions # custom functions see below
│ ├── functions # custom functions
│ ├── plugins # sourcing plugins
│ ├── zsh_config # zsh specific settings
│ └── zshrc # putting it all together
├── .gitmodules # for dotbot
├── bootstrap # installing packages, plugins, theme, ...
├── install # idempotent main script
├── install.conf.yaml # setup dirs, symlinks, ...
└── Makefile # targets for installing various apps
├── setup # installing packages, plugins, theme, platform specific setups, ...
├── install # idempotent main install script (basic & quick setup)
├── install.conf.yaml # setup dir structure, symlinks, ...
```

### Installation
### Setup (Regular)

Get pre-requisites:

```bash
sudo apt-get update && sudo apt-get install -y git
```

Setup ssh for private github repos (optional):
```bash
# use your github email to generate a new ssh key
ssh-keygen -t ed25519 -C "69987866+MaxWolf-01@users.noreply.github.com"
# change permissions of .ssh folder and keys
find ~/.ssh/ -type f -exec chmod 600 {} \; && find ~/.ssh/ -type d -exec chmod 700 {} \; && find ~/.ssh/ -type f -name "*.pub" -exec chmod 644 {} \;
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub
echo "Put your public key on github -> settings -> SSH and GPG keys"
cd ~ && git clone git@github.com:MaxWolf-01/dotfiles.git
# or
cd ~ && git clone --depth 1 git@github.com:MaxWolf-01/dotfiles.git
```

```bash
sudo apt-get update && sudo apt-get install -y git
cd ~
git clone git@github.com:MaxWolf-01/dotfiles.git
mv dotfiles .dotfiles
cd ~/.dotfiles
./install
mv dotfiles .dotfiles && cd ~/.dotfiles && ./install
```

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

Optional next steps:
- Use Makefile to install miniconda, docker, ...

```./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.
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.

### Helpful ...
### 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)

```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
```

``./setup android`` will install essential packages and setup 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.
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**

Expand All @@ -78,39 +100,43 @@ Optional next steps:
- ``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 in a directory; smallest if n is negative; n defaults to 10)
- ``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.)
- ``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)
- ``conda`` / ``pip`` (aliases prevent accidentally installing packages in the base env. Skip the alias by using `\conda` / `\pip` )
- and more ... (see functions / aliases in [zsh folder](https://github.com/MaxWolf-01/dotfiles/tree/master/zsh))

**Scripts**
using `\conda` / `\pip` )
- and many more ... (see functions / aliases in [zsh folder](https://github.com/MaxWolf-01/dotfiles/tree/master/zsh))

- ``sshperm`` (change permissions of .ssh folder and keys)
Various **scripts**, such as gnome keyboard shortcut backup/restore, laptop battery limiter, backup scripts, nightlight
toggle shortcuts, ...

**Plugins**

- [fzf](https://github.com/junegunn/fzf) - fuzzy finder for commands (Ctrl + R) and files (Ctrl + T), (Alt + C) to cd into selected dir. Examples:
- ``vim <Ctrl + T>`` OR ``vim **<tab>`` (trigger `**` can be changed in [exports](https://github.com/MaxWolf-01/dotfiles/blob/master/zsh/exports))
- ``git switch $(git branch -a | fzf)``
- [fzf](https://github.com/junegunn/fzf) - fuzzy finder for commands (Ctrl + R) and files (Ctrl + T), (Alt + C) to cd
into selected dir. Examples:
- ``vim <Ctrl + T>`` OR ``vim **<tab>`` (trigger `**` can be changed
in [exports](https://github.com/MaxWolf-01/dotfiles/blob/master/zsh/exports))
- ``git switch $(git branch -a | fzf)``
- [Zap](https://github.com/zap-zsh/zap) plugin manger
- [Zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting)
- [Zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions)
- ...


### Credits

- [Dotbot](https://github.com/anishathalye/dotbot/tree/da928a4c6b65148bfda3138674da1730c143f396)
- [Jovial Theme](https://github.com/zthxxx/jovial)
- [Zsh](https://www.zsh.org/)
- Various functions and aliases from other great dotfiles repos (see top of [functions](https://github.com/MaxWolf-01/dotfiles/blob/master/zsh/functions))
- Various functions, aliases and scripts from other great dotfiles repos (see top
of [functions](https://github.com/MaxWolf-01/dotfiles/blob/master/zsh/functions) / the respective scripts)
- More resources on dotfiles:
- [dotfiles.github.io](https://dotfiles.github.io/)
- [dotfiles.github.io](https://dotfiles.github.io/)

### Visuals
![screenshot-ubuntu](https://github-production-user-asset-6210df.s3.amazonaws.com/69987866/281566583-dbcb2895-8ae7-4ed0-9a7a-b31ae9e71a26.png)
![screenshot-proxmox](https://user-images.githubusercontent.com/69987866/222906712-a760aab9-39dc-40aa-91e2-dd5e89290749.png)
![screenshot-android](https://github.com/MaxWolf-01/dotfiles/assets/69987866/bab21cc9-6d40-4a7b-a021-feccf843d290)

<img src="https://github-production-user-asset-6210df.s3.amazonaws.com/69987866/281566583-dbcb2895-8ae7-4ed0-9a7a-b31ae9e71a26.png" width="350">
<img src="https://user-images.githubusercontent.com/69987866/222906712-a760aab9-39dc-40aa-91e2-dd5e89290749.png" width="350">
<br>
<img src="https://github.com/MaxWolf-01/dotfiles/assets/69987866/54ade9f2-239f-427a-9888-d8469d0e3134" width="250">
23 changes: 23 additions & 0 deletions bin/decrypt_enc_files
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Decrypt all .enc files in the current directory and subdirectories with openssl and a key file

KEY_FILE=".encryption_key"
DECRYPTION_CIPHER="aes-256-cbc"
PATTERN="*.enc"

if [ ! -f "$KEY_FILE" ]; then
echo "Encryption key file not found!"
exit 1
fi

DECRYPTION_KEY=$(cat "$KEY_FILE")

# Find and decrypt all files with the .enc extension
find . -type f -name "$PATTERN" | while read -r f; do
if openssl enc -d -${DECRYPTION_CIPHER} -pbkdf2 -iter 10000 -in "$f" -out "${f%.enc}" -pass pass:"$DECRYPTION_KEY"; then
echo "Decrypted ${f}"
else
echo "Failed to decrypt $f"
fi
done
Loading

0 comments on commit dec6028

Please sign in to comment.