Skip to content

Instantly share code, notes, and snippets.

@bartoszek
bartoszek / wykop-ublock-filters.txt
Created August 16, 2021 06:50
wykop ublock filters
! 2021-04-22 https://www.wykop.pl
www.wykop.pl##li.iC.link:has(a[href^="https://www.wykop.pl/paylink"])
www.wykop.pl##li.iC.link:has(a[title^="dodaj jako znalezisko"])
! 2021-06-01 https://www.wykop.pl
www.wykop.pl##.wgt-meczyki
@bartoszek
bartoszek / aur-remove-duplicates.sh
Created March 3, 2021 09:19
aurutils: clean local repo from cached remote packages.
#!/bin/bash
#todo:
# * fix remove redundant packages in multiple local repo
# * handle broken db (when new package is present in repo path but not added to repo db, e.g. after no space left on device error)
# * duplicated pacakges: fix remove from package originated in if multiple local repos.
# * package not referenced in db: add tag showing in which repository the package is present.
# * add info about which repo owns the redundant file (pacrep "${pkgname}")
# * add fileter to remove local repo packages from pacman cache (when local package is not present in pacman.conf CACHE_DIR / check aur(1) )
# * filter out old versions of package, or remove them before precede.
@bartoszek
bartoszek / git_submodule_PKGBUILD_conf.sh
Last active April 25, 2023 08:40
PKGBUILD: generate git submodule configuration.
#!/bin/bash
# shellcheck disable=SC2164,SC2154 # mask unsafe cd and uninitialized variables warings
shopt -s globstar
# How to use:
# * run in PKGBUILD dir or pass path to PKGBUILD as argument
# this will generate volatile source tree in $TMP (default: /tmp) and
# generate source array and prepare_submodule() function to init them
# * add local=1 env var to use src/ dir in PKGBUILD path instead of $TMP
# * add remote=1 env var to update module past the pined commit hash
@bartoszek
bartoszek / pdf_unscramble.sh
Last active December 28, 2020 17:22
unscramble pdf on gcloud/wsl
#!/bin/bash
#depends
[[ $# != 1 ]] && { echo "useage: $(basename $0) pdf_file" >&2; exit 10; }
hash pdftoppm pdfunite tesseract || sudo apt install -y poppler-utils tesseract-ocr{,-pol}
#tmp
tmp=$(mktemp -d)
trap "rm -rf $tmp" EXIT
@bartoszek
bartoszek / pdf_unscramble.sh
Created December 28, 2020 16:53
Unscramble pdf protected with costume font.
#!/bin/bash
#depends
[[ $# != 1 ]] && { echo "useage: $(basename $0) pdf_file" >&2; exit 10; }
for dep in pdftoppm tesseract pdfunite; do
hash "$dep" || { echo "requires: $dep" >&2; exit 11; }
done
#tmp
tmp=$(mktemp -d)
@bartoszek
bartoszek / aur-add-github-remote.sh
Last active April 11, 2019 06:48
Move AUR packages to github.com and post message to package comment section informing users about the switch.
#!/bin/bash -x
# configuration: github user(required), github token(optional)
token="" #https://developer.github.com/v3/guides/getting-started/#oauth
user=""
#test if user non-zero
[ -z "$user" ] && {
echo "fill user variable in configuration section" >&2;
@bartoszek
bartoszek / gentrusty.sh
Last active November 25, 2018 13:54 — forked from zellio/gentrusty.sh
Generate Ubuntu Trusty container that will boot under systemd-nspawn
#!/usr/bin/env bash
function __main
{
local -r path="$(realpath "${1:-.}")"
debootstrap --variant=buildd trusty "$1" http://archive.ubuntu.com/ubuntu/
patch --unified "$path/etc/init/console.conf" <<'EOF'
@@ -3,7 +3,8 @@
# This service maintains a getty on console from the point the system is
# started until it is shut down again.