Skip to content

Instantly share code, notes, and snippets.

View obfusk's full-sized avatar
🏳️‍🌈
hacking ⇒ ¬sleeping 😸

FC (Fay) Stegerman obfusk

🏳️‍🌈
hacking ⇒ ¬sleeping 😸
View GitHub Profile
@obfusk
obfusk / screen-quit.sh
Created October 24, 2023 21:45
quit screen session after command finishes successfully
do_stuff && screen -X -S $( screen -ls | awk '{print $1}' | grep "^$PPID\." ) quit
@obfusk
obfusk / catima-locale-diff.sh
Last active October 23, 2023 00:51
diff locales for catima
#!/bin/bash
diff -Naur \
<( sed -n '/name="locale_values"/,/string-array/p' < app/src/main/res/values/settings.xml \
| grep '<item>' | sed -r 's!.*>(.*)<.*!\1!' | sort | grep -v '^en$' ) \
<( ls app/src/main/res/values-* -d | sed 's!.*values-!!' | grep -Ev 'night|w600dp' ) \
| bat -p -l diff
@obfusk
obfusk / index-curl-jq.sh
Created October 4, 2023 22:38
a few f-droid index curl + jq commands
curl -s https://f-droid.org/repo/index-v2.json | ...
... | jq -r '.packages[] | [.versions[]] | max_by(.manifest.versionCode) | .manifest.usesSdk.targetSdkVersion' | sort -n | uniq -c
... | jq -r '.packages | to_entries[] | select([.value.versions[]] | max_by(.manifest.versionCode) | .manifest.usesSdk.targetSdkVersion < 23) | select(.value.metadata.lastUpdated/1000 > now-365/2*24*3600) | .key' | wc -l
@obfusk
obfusk / strings.sh
Last active September 29, 2023 00:45
safer (but also much slower) strings command
#!/bin/bash
LC_ALL=C exec grep -ahPo '[\x09\x20-\x7E]{4,}' -- "$@"
@obfusk
obfusk / .gitignore
Last active October 5, 2023 19:37
-> https://github.com/obfusk/fdroid-mirrors-timestamp | check f-droid mirrors' timestamps
/fdroid-statuspage-deployment
@obfusk
obfusk / indexdiff.py
Last active September 27, 2023 17:06
diff f-droid v2 index (new apps & versions)
#!/usr/bin/python3
import json
from typing import Any, Dict, Iterable, List, Set, Tuple
def packages(data: Dict[str, Any]) -> Dict[str, str]:
d = {}
for k, v in data["packages"].items():
m = v["metadata"]
@obfusk
obfusk / h2-to-h3.js
Created September 5, 2023 19:43
replace all but the first h2 with h3 using JS
[...document.getElementsByTagName("h2")].forEach((x, i) => { if (i > 0) { y = document.createElement("h3"); y.innerHTML = x.innerHTML; x.parentNode.replaceChild(y, x) } })

If this app -- which many people had no choice but to rely on -- was supposed to be open source, then IMO it failed.

You had F-Droid maintainers willing to help bring the app to F-Droid and thus make it available to people without being forced to use the Play Store and accept Google's terms of service; however:

The code may use an open-source license, but the images are not redistributable

Finally – The EUPL 1.2 and the CC0 do not apply to photos, videos, infographics or other forms of images. It is therefore not permitted to reuse or transfer the image, unless the image explicitly states that it is permitted or you have received written permission of the Dutch Government. Such permission will not be withheld on unreasonable grounds.

I asked for permission several times but never received a reply. So the app had to be forked -- and looked much worse without the images -- for no good reason.

@obfusk
obfusk / locales.patch
Created September 3, 2023 20:58
catima locales
diff --git a/app/build.gradle b/app/build.gradle
index 1758fc5d..7bbf65c8 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -24,6 +24,8 @@ android {
vectorDrawables.useSupportLibrary true
multiDexEnabled true
+
+ resourceConfigurations += ["ar", "bg", "bn", "bn-rIN", "bs", "ca", "cs", "cy", "da", "de", "el-rGR", "en", "eo", "es", "es-rAR", "fi", "fr", "he-rIL", "hi", "hr", "hu", "in-rID", "is", "it", "ja", "ko", "lt", "lv", "nb-rNO", "nl", "oc", "pl", "pt", "ro-rRO", "ru", "sk", "sl", "sv", "tr", "uk", "zh-rCN", "zh-rTW"]
@obfusk
obfusk / x.java
Last active August 27, 2023 16:48
java stuff
public class DisplayOption {
String item;
boolean checked;
Consumer<Boolean> callback;
public DisplayOption(String item, boolean checked, Consumer<Boolean> callback) {
this.item = item;
this.checked = checked;
this.callback = callback;
}
}