commit a45a0e8685348340902660e8ed62247b8555f62b Author: nullprop Date: Thu Mar 10 22:01:56 2022 +0200 Squashed diff --git a/.aliases.sh b/.aliases.sh new file mode 100644 index 0000000..0d0e44d --- /dev/null +++ b/.aliases.sh @@ -0,0 +1,74 @@ +# Common aliases. +# Add `source ~/.aliases.sh` to your shell cfg. + +export PATH=$PATH:$HOME/bin:$HOME/.cargo/bin +export HISTSIZE=100 + +# jump 1 word with ctrl-arrow in some terminals +bindkey "^[[1;5C" forward-word +bindkey "^[[1;5D" backward-word + +function screen_brightness() { + redshift -x + + brightness="${1:-1}" + temp="${2:-6500}" + + xrandr --output DP-1 --brightness "$brightness" + xrandr --output DP-3 --brightness "$brightness" + + redshift -O "$temp" +} +alias sb=screen_brightness + +function upload() { + if [ "$#" -ne 2 ]; then + echo "Invalid number of parameters" + echo "usage: upload " + return + fi + + if [ -z "$FILE_STORAGE_API_KEY" ]; then + echo "No API key set, did you forget to 'source ~/.tokens'?" + return + fi + + echo "Uploading to $1/$2" + + curl --request PUT \ + --url "$FILE_STORAGE_API_URL/$1/$2" \ + --header "AccessKey: 0$FILE_STORAGE_API_KEY" \ + --header "Content-Type: application/octet-stream" \ + --header "accept: application/json" \ + --data-binary "@$2" + + echo "" + echo "$FILE_STORAGE_EXTERNAL_URL/$1/$2 (copied to clipboard)" + echo "$FILE_STORAGE_EXTERNAL_URL/$1/$2" | xclip -sel clip +} + +function upload_all() { + for X in *; do + upload $1 $X + done +} + +alias remove_exif="mogrify -verbose -strip *.jpg" + +alias tf2="steam -applaunch 440 -noborder -windowed -w 1920 -h 1080 +fps_max 240" + +alias ga="git add" +alias gts="git status" +alias gd="git diff" +alias gp="git push" +alias gpf="git push --force-with-lease" +alias gpl="git pull" +alias gc="git commit" +alias gup="git fetch && git pull && git submodule update --recursive" +alias greb="git fetch && git pull && git rebase origin/master" + +alias ls="eza --long --all --header --group --icons=always" +alias mkdir="mkdir -p" + +alias disc="firejail discord --ignore-gpu-blocklist --disable-features=UseOzonePlatform --enable-features=VaapiVideoDecoder --use-gl=desktop --enable-gpu-rasterization --enable-zero-copy" + diff --git a/.config/autostart/org.fcitx.Fcitx5.desktop b/.config/autostart/org.fcitx.Fcitx5.desktop new file mode 100644 index 0000000..ed14ec7 --- /dev/null +++ b/.config/autostart/org.fcitx.Fcitx5.desktop @@ -0,0 +1,16 @@ +[Desktop Entry] +Categories=System;Utility; +Comment=Start Input Method +Exec=/usr/bin/fcitx5 +GenericName=Input Method +Icon=fcitx +Name=Fcitx 5 +StartupNotify=false +Terminal=false +Type=Application +X-GNOME-AutoRestart=false +X-GNOME-Autostart-Notify=false +X-KDE-StartupNotify=false +X-KDE-Wayland-Interfaces=org_kde_plasma_window_management +X-KDE-Wayland-VirtualKeyboard=true +X-KDE-autostart-after=panel diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3610a1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +yay/ + diff --git a/.tokens_template b/.tokens_template new file mode 100644 index 0000000..4d44baf --- /dev/null +++ b/.tokens_template @@ -0,0 +1,3 @@ +FILE_STORAGE_API_KEY=my-secret-key +FILE_STORAGE_API_URL=https://my-file-host-api.url +FILE_STORAGE_EXTERNAL_URL=https://hello-friend-have-a-file.url diff --git a/bin/compress.sh b/bin/compress.sh new file mode 100755 index 0000000..b7ed1b0 --- /dev/null +++ b/bin/compress.sh @@ -0,0 +1,30 @@ +#!/bin/bash -x + +set -euo pipefail + +if [ "$#" -ne 5 ]; then + echo "Invalid number of parameters" + echo "Usage: compress.sh " + echo "Example: compress.sh foo.mp4 30 1024k 128k bar.mp4" + exit 1 +fi + +INPUT="$1" +FPS="$2" +VBIT="$3" +ABIT="$4" +OUTPUT="$5" + +AUDIO=("-c:a" "aac" "-b:a" "$ABIT") + +# Don't murder audio quality with recompress if already appropriate bitrate +if [ "$ABIT" == "copy" ]; then + AUDIO=("-c:a" "copy") +fi + +ffmpeg -y -i "$INPUT" -c:v libx264 -r "$FPS" -preset slow -b:v "$VBIT" -pass 1 -vsync cfr -f null /dev/null && \ + ffmpeg -y -i "$INPUT" -c:v libx264 -r "$FPS" -b:v "$VBIT" -pass 2 "${AUDIO[@]}" -preset slow "$OUTPUT" + +rm ffmpeg2pass-0.log +rm ffmpeg2pass-0.log.mbtree + diff --git a/bin/hammer.sh b/bin/hammer.sh new file mode 100755 index 0000000..2d20805 --- /dev/null +++ b/bin/hammer.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -euo pipefail + +cd "$HOME/tf_hammer/bin/x64" + +wine hammerplusplus.exe + diff --git a/bin/install-wow-addons.sh b/bin/install-wow-addons.sh new file mode 100755 index 0000000..e005171 --- /dev/null +++ b/bin/install-wow-addons.sh @@ -0,0 +1,9 @@ +#!/bin/bash -x + +version=_retail_ +addons_path="$HOME/World of Warcraft/$version/Interface/AddOns/" + +cp ~/Downloads/wow-addons/*.zip "$addons_path" +cd "$addons_path" +unzip "./*.zip" +rm ./*.zip diff --git a/bin/unreal.sh b/bin/unreal.sh new file mode 100755 index 0000000..a2f2466 --- /dev/null +++ b/bin/unreal.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -euo pipefail +shopt -s nullglob + +ADDITIONAL="" +PROJECTS=(*.uproject) + +if [[ ${#PROJECTS[@]} -gt 0 ]]; then + ADDITIONAL="$(pwd)/${PROJECTS[0]}" + echo "Found project, passing to cli: '$ADDITIONAL'" +fi + +"$HOME/UnrealEngine/UE_5-4-2/Engine/Binaries/Linux/UnrealEditor" $ADDITIONAL + diff --git a/bin/update_hammer.sh b/bin/update_hammer.sh new file mode 100755 index 0000000..b0da25d --- /dev/null +++ b/bin/update_hammer.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euo pipefail + +echo "Make sure that the TF2 Windows Client depo is up to date." +echo "You should run:" +echo " steam -console" +echo "And then via Steam console:" +echo " download_depot 440 232251" + +read -p "Press enter to continue" + +cd "$HOME/tf_hammer/" +cp -rs --update=none "$HOME/.steam/steam/steamapps/common/Team Fortress 2/"* ./ +cp -rs --update=none "$HOME/.steam/steam/ubuntu12_32/steamapps/content/app_440/depot_232251/"* ./ + diff --git a/fcitx.sh b/fcitx.sh new file mode 100644 index 0000000..26fd8ff --- /dev/null +++ b/fcitx.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +uid=$(id -u) +if [ $uid == 0 ]; then + echo "run as normal user" + exit +fi + +# fcitx5 mozc +read -p "set fcitx env? [y/N]" prompt +if [[ $prompt == "y" ]]; then + echo GTK_IM_MODULE=fcitx | sudo tee -a /etc/environment + echo QT_IM_MODULE=fcitx | sudo tee -a /etc/environment + echo XMODIFIERS=@im=fcitx | sudo tee -a /etc/environment + echo SDL_IM_MODULE=fcitx | sudo tee -a /etc/environment +fi + +read -p "launch fcitx5-configtool? [y/N]" prompt +if [[ $prompt == "y" ]]; then + fcitx5-configtool +fi \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..045e6e5 --- /dev/null +++ b/install.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +uid=$(id -u) +if [ $uid == 0 ]; then + echo "run as normal user" + exit +fi + +# packages +sudo pacman -Syu + +sudo pacman -S \ + git-lfs \ + gcc \ + cmake \ + make \ + clang \ + curl \ + dkms \ + udev \ + base-devel \ + linux-headers \ + meson \ + ninja \ + gdb \ + xclip \ + gcc \ + python \ + steam \ + discord \ + krita \ + vlc \ + keepassxc \ + audacity \ + yt-dlp \ + obs-studio \ + gamemode \ + gamescope \ + deluge \ + firejail \ + btop \ + dotnet-sdk \ + fcitx5 \ + fcitx5-mozc \ + fcitx5-qt \ + fcitx5-gtk \ + fcitx5-nord \ + fcitx5-configtool \ + lib32-fontconfig \ + ttf-liberation \ + wqy-zenhei \ + darktable \ + zip \ + unzip \ + nvtop \ + stow \ + otf-font-awesome \ + libreoffice-still \ + zola \ + alacritty \ + imagemagick \ + man-db \ + fuse2 \ + fuse3 \ + neovim \ + nodejs \ + npm \ + zsh \ + eza + +# yay :) +read -p "install yay? [y/N]" prompt +if [[ $prompt == "y" ]]; then + git clone https://aur.archlinux.org/yay.git + cd yay + makepkg -si + cd .. +fi + +# logitech wheel +read -p "install wheel stuff? [y/N]" prompt +if [[ $prompt == "y" ]]; then + yay -S new-lg4ff-git + yay -S oversteer +fi + +# shell +read -p "install zsh? [y/N]" prompt +if [[ $prompt == "y" ]]; then + yay -S --noconfirm zsh-theme-powerlevel10k-git + echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc + sudo chsh -s /usr/bin/zsh + echo 'source ~/.aliases' >>~/.zshrc + echo 'autoload -Uz compinit' >>~/.zshrc + echo 'compinit' >>~/.zshrc +fi + +# rust +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + +# home configs +./link.sh + +sudo pacman -Qdtq | sudo pacman -Rs - +sudo pacman -Sc diff --git a/link.sh b/link.sh new file mode 100755 index 0000000..644c9c6 --- /dev/null +++ b/link.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +ln -s "$(pwd)/.aliases.sh" "$HOME/.aliases.sh" + +mkdir -p ~/bin +stow --target=$HOME/bin bin +sudo chmod +x ~/bin/*.sh + +mkdir -p ~/.config +stow --target=$HOME/.config .config + +cp --update=none .tokens_template ~/.tokens