Compare commits
No commits in common. "22b70a06390950c31c3f86f48a8f727ed8253f9a" and "2fa52d6b9054bbb03a1f6756f2c4fc71545e981c" have entirely different histories.
22b70a0639
...
2fa52d6b90
6 changed files with 148 additions and 160 deletions
|
@ -13,6 +13,8 @@ alias g='git'
|
||||||
alias ga='git add'
|
alias ga='git add'
|
||||||
alias gaa='git add --all'
|
alias gaa='git add --all'
|
||||||
alias gai='git add -i'
|
alias gai='git add -i'
|
||||||
|
alias gb='git branch'
|
||||||
|
alias gbd='git branch -d'
|
||||||
|
|
||||||
alias gc='git commit -v'
|
alias gc='git commit -v'
|
||||||
alias gc!='git commit -v --amend'
|
alias gc!='git commit -v --amend'
|
||||||
|
@ -94,22 +96,4 @@ else
|
||||||
alias gsta='git stash save'
|
alias gsta='git stash save'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if exist git-bug; then
|
|
||||||
gb() {
|
|
||||||
if [ "$#" -eq 1 ]; then
|
|
||||||
git bug show "$1"
|
|
||||||
else
|
|
||||||
git bug ls "$@"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
alias gbt='git bug termui'
|
|
||||||
|
|
||||||
alias gba='git bug add'
|
|
||||||
alias gbm='git bug comment add'
|
|
||||||
alias gbc='git bug status close'
|
|
||||||
|
|
||||||
alias gbp='git bug push'
|
|
||||||
alias gbl='git bug pull'
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset -v git_version
|
unset -v git_version
|
||||||
|
|
|
@ -103,9 +103,6 @@ local prose_plugs = {
|
||||||
-- simple static markdown linking and link following using zettel IDs
|
-- simple static markdown linking and link following using zettel IDs
|
||||||
{
|
{
|
||||||
"marty-oehme/zettelkasten.nvim",
|
"marty-oehme/zettelkasten.nvim",
|
||||||
dependencies = {
|
|
||||||
"mickael-menu/zk-nvim", -- for the CD when opening index
|
|
||||||
},
|
|
||||||
ft = writing_ft,
|
ft = writing_ft,
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
|
@ -125,7 +122,6 @@ local prose_plugs = {
|
||||||
{
|
{
|
||||||
"<leader>ni",
|
"<leader>ni",
|
||||||
function()
|
function()
|
||||||
require("zk.commands").get("ZkCd")()
|
|
||||||
require("zettelkasten").index_open()
|
require("zettelkasten").index_open()
|
||||||
end,
|
end,
|
||||||
desc = "index page",
|
desc = "index page",
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
# v shorthand for neovim
|
|
||||||
if exist nvim; then
|
|
||||||
alias v="nvim"
|
|
||||||
alias vim="nvim"
|
|
||||||
|
|
||||||
# open notes with my vim zettelkasten plugin
|
|
||||||
# TODO better implementation conditional on zk & zettelkasten existing
|
|
||||||
alias vn='nvim +"lua require \"zk.commands\".get(\"ZkCd\")()" +"lua require \"zettelkasten\".index_open()"'
|
|
||||||
fi
|
|
|
@ -1,39 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# Automatically git commits, pushes and pulls if doable in the taskwarrior data directory
|
|
||||||
#
|
|
||||||
# Much of this taken from: https://github.com/mrschyte/taskwarrior-hooks/
|
|
||||||
# with much gratitude
|
|
||||||
|
|
||||||
if [ "${DISABLE_HOOKS}" = "true" ] || ! command -v git >/dev/null 2>&1; then
|
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$1" != "api:2" ]; then
|
|
||||||
printf "Taskwarrior uses different data API version than git plugin. Aborting!" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
data_dir="$(echo "$5" | cut -f2 -d:)"
|
|
||||||
command_run="$(echo "$3" | cut -f2 -d:)"
|
|
||||||
|
|
||||||
# after any command, if there's changes add and commit
|
|
||||||
if ! git -C "$data_dir" diff --exit-code >/dev/null 2>&1; then
|
|
||||||
# need to run to fully update tasks that just got done
|
|
||||||
DISABLE_HOOKS=true env task next >/dev/null 2>&1
|
|
||||||
|
|
||||||
header="auto: ${2##* }"
|
|
||||||
msg="full command: $2"
|
|
||||||
git -C "$data_dir" commit -a -m "$header" -m "$msg" --no-gpg-sign >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$command_run" = "synchronize" ]; then
|
|
||||||
DISABLE_HOOKS=true env task sync
|
|
||||||
|
|
||||||
git -C "$data_dir" pull >/dev/null 2>&1
|
|
||||||
pull_ret="$?"
|
|
||||||
git -C "$data_dir" push >/dev/null 2>&1
|
|
||||||
push_ret="$?"
|
|
||||||
if [ "$pull_ret" -eq 0 ] && [ "$push_ret" -eq 0 ]; then
|
|
||||||
echo Git upstream synchronized.
|
|
||||||
fi
|
|
||||||
fi
|
|
|
@ -1,8 +1,6 @@
|
||||||
import random
|
import random
|
||||||
import re
|
|
||||||
from typing import Any, Callable
|
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
|
import re
|
||||||
from qutebrowser.api import interceptor
|
from qutebrowser.api import interceptor
|
||||||
from qutebrowser.extensions.interceptors import QUrl, RedirectException
|
from qutebrowser.extensions.interceptors import QUrl, RedirectException
|
||||||
from qutebrowser.utils import message
|
from qutebrowser.utils import message
|
||||||
|
@ -32,81 +30,157 @@ def fixScribePath(url: QUrl):
|
||||||
redirects = {
|
redirects = {
|
||||||
"youtube": {
|
"youtube": {
|
||||||
"source": ["youtube.com"],
|
"source": ["youtube.com"],
|
||||||
"farside": ["invidious"],
|
"target": [
|
||||||
},
|
"invidious.no-logs.com",
|
||||||
"stackoverflow": {
|
"inv.citw.lgbt",
|
||||||
"source": ["stackoverflow.com"],
|
"invidious.privacydev.net",
|
||||||
"farside": ["anonymousoverflow"],
|
"inv.tux.pizza",
|
||||||
|
"invidious.einfachzocken.eu",
|
||||||
|
"invidious.perennialte.ch",
|
||||||
|
"invidious.fdn.fr",
|
||||||
|
"invidious.nerdvpn.de",
|
||||||
|
"inv.zzls.xyz",
|
||||||
|
"invidious.private.coffee",
|
||||||
|
"invidious.projectsegfau.lt",
|
||||||
|
"invidious.lunar.icu",
|
||||||
|
"yewtu.be",
|
||||||
|
"iv.melmac.space",
|
||||||
|
"iv.datura.network",
|
||||||
|
"piped.kavin.rocks",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"lbry": {
|
"lbry": {
|
||||||
"source": ["odysee.com"],
|
"source": ["odysee.com"],
|
||||||
"farside": ["librarian"],
|
"target": [
|
||||||
|
"lbry.bcow.xyz",
|
||||||
|
"odysee.076.ne.jp",
|
||||||
|
"librarian.pussthecat.org",
|
||||||
|
"lbry.mutahar.rocks",
|
||||||
|
"lbry.vern.cc",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"reddit": {
|
"reddit": {
|
||||||
"source": ["reddit.com"],
|
"source": ["reddit.com"],
|
||||||
"farside": ["redlib"],
|
"target": [
|
||||||
},
|
"teddit.ggc-project.de",
|
||||||
"instagram": {
|
"teddit.kavin.rocks",
|
||||||
"source": ["instagram.com"],
|
"teddit.zaggy.nl",
|
||||||
"farside": ["proxigram"],
|
"teddit.namazso.eu",
|
||||||
|
"teddit.nautolan.racing",
|
||||||
|
"teddit.tinfoil-hat.net",
|
||||||
|
"teddit.domain.glass",
|
||||||
|
"libreddit.kavin.rocks",
|
||||||
|
"safereddit.com",
|
||||||
|
"reddit.invak.id",
|
||||||
|
"reddit.simo.sh",
|
||||||
|
"libreddit.strongthany.cc",
|
||||||
|
"libreddit.domain.glass",
|
||||||
|
"libreddit.pussthecat.org",
|
||||||
|
"libreddit.kylrth.com",
|
||||||
|
"libreddit.privacydev.net",
|
||||||
|
"l.opnxng.com",
|
||||||
|
"libreddit.oxymagnesium.com",
|
||||||
|
"reddit.utsav2.dev",
|
||||||
|
"libreddit.freedit.eu",
|
||||||
|
"lr.artemislena.eu",
|
||||||
|
"snoo.habedieeh.re",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"twitter": {
|
"twitter": {
|
||||||
"source": ["twitter.com"],
|
"source": ["twitter.com"],
|
||||||
"farside": ["nitter"],
|
"target": [
|
||||||
|
"nitter.net",
|
||||||
|
"nitter.42l.fr",
|
||||||
|
"nitter.fdn.fr",
|
||||||
|
"nitter.1d4.us",
|
||||||
|
"nitter.kavin.rocks",
|
||||||
|
"nitter.unixfox.eu",
|
||||||
|
"nitter.namazso.eu",
|
||||||
|
"nitter.moomoo.me",
|
||||||
|
"bird.trom.tf",
|
||||||
|
"nitter.it",
|
||||||
|
"twitter.censors.us",
|
||||||
|
"nitter.grimneko.de",
|
||||||
|
"twitter.076.ne.jp",
|
||||||
|
"n.l5.ca",
|
||||||
|
"unofficialbird.com",
|
||||||
|
"nitter.ungovernable.men",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"imdb": {
|
"imdb": {
|
||||||
"source": ["imdb.com"],
|
"source": ["imdb.com"],
|
||||||
"farside": ["libremdb"],
|
"target": [
|
||||||
|
"libremdb.iket.me",
|
||||||
|
"libremdb.pussthecat.org",
|
||||||
|
"ld.vern.cc",
|
||||||
|
"binge.whatever.social",
|
||||||
|
"libremdb.lunar.icu",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"translate": {
|
"translate": {
|
||||||
"source": ["translate.google.com"],
|
"source": ["translate.google.com"],
|
||||||
"farside": ["lingva"],
|
"target": [
|
||||||
|
"lingva.ml",
|
||||||
|
"translate.igna.wtf",
|
||||||
|
"translate.plausibility.cloud",
|
||||||
|
"translate.projectsegfau.lt",
|
||||||
|
"translate.dr460nf1r3.org",
|
||||||
|
"lingva.garudalinux.org",
|
||||||
|
"translate.jae.fi",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"tiktok": {
|
"tiktok": {
|
||||||
"source": ["tiktok.com"],
|
"source": ["tiktok.com"],
|
||||||
"farside": ["proxitok"],
|
"target": [
|
||||||
|
"proxitok.pabloferreiro.es",
|
||||||
|
"proxitok.pussthecat.org",
|
||||||
|
"tok.habedieeh.re",
|
||||||
|
"proxitok.privacydev.net",
|
||||||
|
"proxitok.odyssey346.dev",
|
||||||
|
"tok.artemislena.eu",
|
||||||
|
"tok.adminforge.de",
|
||||||
|
"proxitok.manasiwibi.com",
|
||||||
|
"tik.hostux.net",
|
||||||
|
"tt.vern.cc",
|
||||||
|
"proxitok.mha.fi",
|
||||||
|
"proxitok.pufe.org",
|
||||||
|
"proxitok.marcopisco.com",
|
||||||
|
"cringe.whatever.social",
|
||||||
|
"proxitok.lunar.icu",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"imgur": {
|
"imgur": {
|
||||||
"source": ["imgur.com"],
|
"source": ["imgur.com"],
|
||||||
"farside": ["rimgo"],
|
"target": [
|
||||||
|
"imgur.artemislena.eu",
|
||||||
|
"ri.zzls.xyz",
|
||||||
|
"rimgo.bus-hit.me",
|
||||||
|
"rimgo.fascinated.cc",
|
||||||
|
"rimgo.hostux.net",
|
||||||
|
"rimgo.kling.gg",
|
||||||
|
"rimgo.lunar.icu",
|
||||||
|
"rimgo.marcopisco.com",
|
||||||
|
"rimgo.privacytools.io",
|
||||||
|
"rimgo.projectsegfau.lt",
|
||||||
|
"rimgo.pussthecat.org",
|
||||||
|
"rimgo.totaldarkness.net",
|
||||||
|
"rimgo.whateveritworks.org",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"medium": {
|
"medium": {
|
||||||
"source": ["medium.com"],
|
"source": ["medium.com"],
|
||||||
"farside": ["scribe"],
|
"target": [
|
||||||
# "postprocess": fixScribePath
|
"scribe.rip",
|
||||||
},
|
"scribe.citizen4.eu",
|
||||||
"fandom": {
|
"scribe.bus-hit.me",
|
||||||
"source": ["fandom.com"],
|
"sc.vern.cc",
|
||||||
"farside": ["breezewiki"],
|
],
|
||||||
},
|
"postprocess": fixScribePath,
|
||||||
"quora": {
|
|
||||||
"source": ["quora.com"],
|
|
||||||
"farside": ["quetre"],
|
|
||||||
# "postprocess": lambda url: message.info(f"CALLING QUORA WITH {url}")
|
|
||||||
},
|
},
|
||||||
"google": {
|
"google": {
|
||||||
"source": ["google.com"],
|
"source": ["google.com"],
|
||||||
"target": [
|
"target": [
|
||||||
"search.albony.xyz",
|
|
||||||
"search.garudalinux.org",
|
|
||||||
"search.dr460nf1r3.org",
|
|
||||||
"s.tokhmi.xyz",
|
|
||||||
"search.sethforprivacy.com",
|
|
||||||
"whoogle.dcs0.hu",
|
"whoogle.dcs0.hu",
|
||||||
"gowogle.voring.me",
|
|
||||||
"whoogle.privacydev.net",
|
|
||||||
"wg.vern.cc",
|
|
||||||
"whoogle.hxvy0.gq",
|
|
||||||
"whoogle.hostux.net",
|
|
||||||
"whoogle.lunar.icu",
|
|
||||||
"wgl.frail.duckdns.org",
|
|
||||||
"whoogle.no-logs.com",
|
|
||||||
"whoogle.ftw.lol",
|
|
||||||
"whoogle-search--replitcomreside.repl.co",
|
|
||||||
"search.notrustverify.ch",
|
|
||||||
"whoogle.datura.network",
|
|
||||||
"whoogle.yepserver.xyz",
|
|
||||||
"search.nezumi.party",
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -125,42 +199,18 @@ def rewrite(request: interceptor.Request) -> None:
|
||||||
url = request.request_url
|
url = request.request_url
|
||||||
|
|
||||||
if service := _should_be_redirected(url.host()):
|
if service := _should_be_redirected(url.host()):
|
||||||
if "farside" in service:
|
# TODO integrate pinging and always surf to fastest?
|
||||||
url = _farside_redirect(url, _pick_random(service["farside"]))
|
target = service["target"][random.randint(0, len(service["target"]) - 1)]
|
||||||
else:
|
if target is not None and url.setHost(target) is not False:
|
||||||
srv = _pick_random(service["target"])
|
if "postprocess" in service:
|
||||||
url = _target_redirect(url, srv)
|
url = service["postprocess"](url)
|
||||||
try:
|
try:
|
||||||
request.redirect(url)
|
request.redirect(url)
|
||||||
except RedirectException as e:
|
except RedirectException as e:
|
||||||
message.error(str(e))
|
message.error(str(e))
|
||||||
|
|
||||||
if "postprocess" in service and isinstance(service["postprocess"], Callable):
|
|
||||||
url = service["postprocess"](url)
|
|
||||||
|
|
||||||
|
def _should_be_redirected(host: str, redirects: dict = redirects) -> dict | None:
|
||||||
def _farside_redirect(url: QUrl, service: str) -> QUrl:
|
|
||||||
try:
|
|
||||||
url.setHost("farside.link")
|
|
||||||
url.setPath(f"/{service}{url.path()}")
|
|
||||||
except RedirectException as e:
|
|
||||||
message.error(str(e))
|
|
||||||
return url
|
|
||||||
|
|
||||||
|
|
||||||
def _target_redirect(url: QUrl, target: str) -> QUrl:
|
|
||||||
if target is not None and url.setHost(target) is not False:
|
|
||||||
return url
|
|
||||||
return url
|
|
||||||
|
|
||||||
|
|
||||||
def _pick_random(choices: list) -> Any:
|
|
||||||
return choices[random.randint(0, len(choices) - 1)]
|
|
||||||
|
|
||||||
|
|
||||||
def _should_be_redirected(
|
|
||||||
host: str, redirects: dict = redirects
|
|
||||||
) -> dict[str, list] | None:
|
|
||||||
for service in redirects.values():
|
for service in redirects.values():
|
||||||
for source in service["source"]:
|
for source in service["source"]:
|
||||||
if re.search(source, host):
|
if re.search(source, host):
|
||||||
|
|
|
@ -7,14 +7,20 @@ exist() { type "$1" >/dev/null 2>&1; }
|
||||||
# Avoid aliases which I did not create -- unalias EVERYTHING
|
# Avoid aliases which I did not create -- unalias EVERYTHING
|
||||||
unalias -a
|
unalias -a
|
||||||
|
|
||||||
if alias v >/dev/null 2>&1; then
|
# v shorthand for neovim
|
||||||
if exist vim; then
|
if exist nvim; then
|
||||||
|
alias v="nvim"
|
||||||
|
alias vim="nvim"
|
||||||
|
alias vs="nvim -c 'ScratchPad'" # open an empty 'scratchpad' which simply disappears after use
|
||||||
|
alias vw="nvim -c \"lua require 'zettelkasten'.index_open()\"" # open to personal wiki
|
||||||
|
elif exist vim; then
|
||||||
alias v="vim"
|
alias v="vim"
|
||||||
else
|
else
|
||||||
alias v="vi"
|
alias v="vi"
|
||||||
alias vim="vi"
|
alias vim="vi"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
# open notes with my vim zettelkasten plugin
|
||||||
|
alias vn='v +"lua require \"zettelkasten\".index_open()"'
|
||||||
|
|
||||||
# exit shell mimicks vim
|
# exit shell mimicks vim
|
||||||
alias :q="exit"
|
alias :q="exit"
|
||||||
|
|
Loading…
Reference in a new issue