This commit is contained in:
Lauri Räsänen 2022-03-10 22:01:56 +02:00
commit a45a0e8685
12 changed files with 311 additions and 0 deletions

74
.aliases.sh Normal file
View file

@ -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 <target_dir> <file>"
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"

View file

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

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
yay/

3
.tokens_template Normal file
View file

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

30
bin/compress.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash -x
set -euo pipefail
if [ "$#" -ne 5 ]; then
echo "Invalid number of parameters"
echo "Usage: compress.sh <input> <fps> <bitrate:v> <bitrate:a/copy> <output>"
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

8
bin/hammer.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail
cd "$HOME/tf_hammer/bin/x64"
wine hammerplusplus.exe

9
bin/install-wow-addons.sh Executable file
View file

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

15
bin/unreal.sh Executable file
View file

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

16
bin/update_hammer.sh Executable file
View file

@ -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/"* ./

21
fcitx.sh Normal file
View file

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

105
install.sh Executable file
View file

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

12
link.sh Executable file
View file

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