Skip to content

Instantly share code, notes, and snippets.

View oscar230's full-sized avatar

Oscar Andersson oscar230

View GitHub Profile
@oscar230
oscar230 / build-page.sh
Last active January 10, 2024 07:24
simple-html-build-script
#!/bin/bash
SRCDIR=$1
OUTDIR=$2
HTMLPATH=$3
COMPONENTSDIR=$SRCDIR"/components/"
sed "s/$(basename $HTMLPATH)//" $COMPONENTSDIR"header.html" > temporaryfilepleaseremove.html
cat temporaryfilepleaseremove.html $HTMLPATH $COMPONENTSDIR"footer.html" > $OUTDIR"/"$(basename $HTMLPATH)
rm temporaryfilepleaseremove.html
@oscar230
oscar230 / notify-upgradeables.sh
Created July 19, 2023 11:24
Notify on telegram when APT can upgrade
APT_UPGRADE=$(apt list --upgradable 2>/dev/null | cut -d/ -f1 | grep -v Listing) && docker run --rm containrrr/shoutrrr:latest send --url "telegram://TOKEN@telegram?chats=CHAT&preview=No&notification=No&title=APT" --message "${APT_UPGRADE:0:4000}"
#!/bin/bash
echo "Starting FLAC to MP3 320kbps converter."
if ! command -v ffmpeg &> /dev/null
then
echo "Error: ffmpeg could not be found"
exit
fi
find . -name "*.flac" -exec ffmpeg -n -i '{}' -ab 320k -map_metadata 0 -id3v2_version 3 '{}'.mp3 \; -exec mv '{}' '{}'.remove \;
echo "Completed."
@oscar230
oscar230 / backup-crontab.sh
Last active October 12, 2022 19:48
Backup crontab
crontab -l > /tmp/crontab_$(whoami)_$(date +%F_%H-%M).bak
@oscar230
oscar230 / gist:c9630762ca293a78c256ee4bcc50a9ee
Created April 14, 2022 05:25
Easy List - YouTube Minimal Web Player Filter
www.youtube.com##ytd-toggle-button-renderer.style-text.force-icon-button.ytd-menu-renderer.style-scope > .ytd-toggle-button-renderer.style-scope.yt-simple-endpoint
www.youtube.com###comments
www.youtube.com##ytd-button-renderer.size-default.style-default.force-icon-button.ytd-menu-renderer.style-scope:nth-of-type(2)
www.youtube.com##.ytd-video-primary-info-renderer.style-scope > .ytd-menu-renderer.style-scope.dropdown-trigger
www.youtube.com##ytd-topbar-menu-button-renderer.style-default.ytd-masthead.style-scope:nth-of-type(1)
www.youtube.com##ytd-topbar-menu-button-renderer.style-default.ytd-masthead.style-scope > .ytd-topbar-menu-button-renderer.style-scope
www.youtube.com##.ytd-rich-grid-renderer.style-scope > .ytd-feed-filter-chip-bar-renderer.style-scope
www.youtube.com###footer
www.youtube.com##ytd-guide-section-renderer.ytd-guide-renderer.style-scope:nth-of-type(3)
@oscar230
oscar230 / docker-compose.yml
Created February 14, 2022 22:47
Docker Watchtower, update inclusion by labels.
version: '3'
services:
watchtower:
image: containrrr/watchtower
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/timezone:/etc/timezone:ro
environment:
@oscar230
oscar230 / bashrc
Created April 9, 2021 10:58
Bash PS1 mildly styleized with current git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[$(tput bold)\]\[\033[38;5;10m\]\u@\[$(tput sgr0)\]\[\033[38;5;165m\]\h\[$(tput sgr0)\]:\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;12m\]\w\[$(tput sgr0)\]\[\033[33m\]\$(parse_git_branch)\[\033[00m\]\\$ \[$(tput sgr0)\]"