Skip to content

Instantly share code, notes, and snippets.

@kytta
kytta / emojiFlag.js
Created March 18, 2024 11:24
Get the emoji flag for an ISO-3166-1 alpha-2 country code.
/**
* Return the emoji flag for an ISO-3166-1 alpha-2 country code.
*
* The ISO code should be a string consisting of two latin characters
* (case-insensitive). Note that this method *does not* check the validity
* of the provided ISO code.
*
* @param {string} isoCode
* ISO-3166-1 alpha-2 country code
* @return {string} the emoji of the country's flag
@kytta
kytta / mastodon.log
Created July 3, 2023 12:33
Logcat output when trying to translate a piece of text in Mastodon v2
2023-07-03 14:30:26.375 10998-10998 AutofillManager org.joinmastodon.android V requestHideFillUi(null): anchor = null
2023-07-03 14:30:26.464 10998-10998 oplus.andr...actoryImpl org.joinmastodon.android I get feature:IOplusDynamicVsyncFeature
2023-07-03 14:30:26.464 10998-10998 oplus.andr...actoryImpl org.joinmastodon.android I get feature:IOplusDynamicVsyncFeature
2023-07-03 14:30:26.464 10998-10998 oplus.andr...actoryImpl org.joinmastodon.android I get feature:IOplusDynamicVsyncFeature
2023-07-03 14:30:26.490 10998-11156 MastodonAPIController org.joinmastodon.android D [fosstodon.org_107218015383863784] Sending request: Request{method=GET, url=https://fosstodon.org/api/v1/statuses/110649998033991795/context, tags={}}
2023-07-03 14:30:26.493 10998-10998 Quality org.joinmastodon.android I Skipped: false 3 cost 66.023094 refreshRate 0 processName org.joinmastodon.android
2023-07-03 14:30:26.554 10998-10998 Q
@kytta
kytta / new-iterm2-window.applescript
Created May 6, 2023 11:19
AppleScript to open a new iTerm2 window (Raycast compatible)
#!/usr/bin/osascript
# This is free and unencumbered software released into the public domain.
# SPDX-License-Identifier: Unlicense OR CC0-1.0
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title New iTerm2 Window
# @raycast.mode silent
# Optional parameters:
@kytta
kytta / count.lite.js
Created February 24, 2023 00:35
A very lightweight GoatCounter count script. It only counts the visit without transferring too much data. Perfect for single-page websites.
// Only count the production website
// TODO: You should replace these with your webpage production URL
if (window.location.host === "domain.tld") {
// Check if the default GC URL resolves
// This allows us to not track people with ad blockers
fetch("//gc.zgo.at/", { method: "HEAD" })
.then((result) => {
if (!result.ok) {
return;
}
@kytta
kytta / swiss_typography.css
Created February 19, 2023 18:09
Most Swiss default fonts
body {
font-family:
"Helvetica Neue", /* macOS - basically our goal */
"Neue Haas Grotesk Text Pro", /* Windows - part of the "Pan-European Supplemental Fonts" package */
Helvetica, /* macOS - also the classic */
"FreeSans", /* Linux - made by GNU, can be installed on most systems */
Arial, /* macOS and Windows - part of the "Core fonts for the Web" */
system-ui, /* if for some reason we're here - let's hope that the system UI font is Swiss */
sans-serif; /* most generic fallback */
}
@kytta
kytta / 2022-11-29-openpgp_key_transition.txt
Created November 29, 2022 01:37
The 2022 OpenPGP key transition
Title: The 2022 OpenPGP key transition
Author: Nikita Karamov
Date: 29 Nov 2022
What follows is a quite long explanation as to what happened to my OpenPGP keys.
TL;DR: Do not use these RSA keys any more:
- 0xF0A49E6D84E6EEBE
Lawnchair bug report 13.08.2022 00:42:45
version: 12.1.0 Alpha 4 (12010005)
commit: b7ad08c
build.brand: OnePlus
build.device: OnePlus7T
build.display: HD1903_14_220617
build.fingerprint: OnePlus/OnePlus7T_EEA/OnePlus7T:11/RKQ1.201022.002/2206171329:user/release-keys
build.hardware: qcom
build.id: RKQ1.201022.002
build.manufacturer: OnePlus
@kytta
kytta / yt-dlp.conf
Last active March 12, 2022 10:46
yt-dlp configuration for optimal music download
# File format: "Artist/Album/# - Track.ext"
-o '%(album_artist)s/%(album)s/%(playlist_index)s - %(title)s.%(ext)s'
--no-mtime
# Get best audio
-f 'ba*'
# Extract audio: MP3, best VBR
-x --audio-format mp3 --audio-quality 0
const date = new Date("1970-01-30");
function logDate(locale) {
console.log(
locale.padStart(8),
" ",
new Intl.DateTimeFormat(locale, { dateStyle: "short" })
.format(date)
.padEnd(16),
new Intl.DateTimeFormat(locale, { dateStyle: "medium" })
@kytta
kytta / openpgp.md
Last active November 29, 2022 00:41