Laru

🔒 Manual approval

@laru@pleroma.laru.dsrv.x7q.eu

about:
hi i like doing stuff with music and computers

usage:
please be direct (but not rude) with me and dont communicate with social cues because i either wont understand them or apply the worst case interpretation
if youre considering to send me a message, just do it (you wont bother me, i have very little social contact)

interests:
programming (c89, typescript), frontend webdev using my own framework, osdev when it works
tinkering with my linux desktop
music theory (math-driven, not convention-driven)
software modular synthesis (using pd)
dj-ing (especially with 90s techno and adjacent genres)
home taping (i kill music)

quirks:
i dont use the followers-only scope; following me will add me to your home timeline but what you see is what youll get
will accept most follow requests except for empty/automated/spam/troll accounts
i wont talk to mean/aggressive people and bigots of any kind
i18n (best to worst)
de, en, pl, cs
natural habitat
SN, Germany
also seen on
xmpp (ask)

Replying to @6@possum.city

@6 @luna its a pretty small script actually, it used to be a shellscript before but i rewrote it to js (ts) because thats less painful to maintain

#!/usr/bin/env -S deno -A
import { readdirSync, readFileSync } from "node:fs";

function getIp(host: string) {
	const ip = {
		phobos:		'10.51.93.117',
		tethys:		'10.51.93.115',
		triton:		'10.51.93.113',
		miranda:	'10.51.93.107',
		cupid:		'10.51.93.105',
	}[host];
	if(!ip) throw new Error(`Unknown host '${host}'`);
	return ip;
}

function mkEntry(domain: string, target: string) {
	const certsAvailable = readdirSync('/etc/letsencrypt/live').sort((a, b) => b.length - a.length);
	const certName = certsAvailable.find(cert => domain.endsWith(cert));
	const upstreamId = domain.replaceAll('.', '_');
	const targetIp = getIp(target.split(':')[0]);
	const targetPort = target.split(':')[1] ?? 80;
	if(!certName) throw new Error(`No cert found for '${domain}'`);

	console.log(`upstream ${upstreamId} {`);
	console.log(`\tserver ${targetIp}:${targetPort};`);
	console.log("}");
	console.log();
	console.log("server {");
	console.log(`\tserver_name ${domain};`);
	console.log();
	console.log("\tlisten 80;");
	console.log("\tlisten [::]:80;");
	console.log("\tlisten 443 ssl;");
	console.log("\tlisten [::]:443 ssl;");
	console.log(`\tssl_certificate /etc/letsencrypt/live/${certName}/fullchain.pem;`);
	console.log(`\tssl_certificate_key /etc/letsencrypt/live/${certName}/privkey.pem;`);
	console.log("\t");
	console.log("\tlocation / {");
	console.log("\t\tproxy_set_header Host \$host;");
	console.log("\t\tproxy_set_header X-Forwarded-Host \$host;");
	console.log("\t\tproxy_set_header X-Forwarded-Server \$host;");
	console.log("\t\tproxy_set_header X-Forwarded-Proto \$scheme;");
	console.log("\t\tproxy_set_header X-Real-IP \$remote_addr;");
	console.log("\t\tproxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;");
	console.log("\t\tproxy_set_header Upgrade \$http_upgrade;");
	console.log("\t\tproxy_set_header Connection \$connection_upgrade;");
	console.log("\t\tproxy_http_version 1.1;");
	console.log("\t\tclient_max_body_size 1G;");
	console.log(`\t\tproxy_pass http://${upstreamId};`);
	console.log("\t}");
	console.log("}");
	console.log("\n");
}

for(const line of readFileSync('proxy.list').toString().trim().split('\n')) {
	const [domain, target] = line.match(/[^ \t]+/g)!;
	mkEntry(domain, target);
}

Replying to @luna@fedi.mldchan.dev

@luna oh i didnt wanna record peoples ips, i do deduplication too but by session rather than date, so someone visiting the site twice will only be counted twice if they close their browser between visits, this also ensures that only browsers get counted and curls/crawlers dont

basically it works like this:
1. is visitor cookie set ? proceed : set it to value a
2. send api request to get visitors
3. set cookie to value b

the api request will only count your visit if the cookie is set to value a, which only happens once per session unless you clear your cookies
basically only a client that evaluates javascript will trigger the counter (ofc this can be circumvented by sending the cookie on purpose but why would anyone do that)

Replying to @luna@fedi.mldchan.dev

@luna my old visitor counter broke when it was at ~500 about a year ago due to it being just a text file with a number in it, which was reset to 0 due to some bug that occured when the disk was full; i removed the counter since then and only fixed it 5 days ago, now its recording a timestamp of every visit in postgresql which allows me to visualize popularity of my site over time

see https://pleroma.laru.dsrv.x7q.eu/notice/B7zXTFnTRs3sVaAeUC
pleroma.laru.dsrv.x7q.euLaru (@laru@pleroma.laru.dsrv.x7q.eu)my new visitor counter is so cool

Replying to @luna@fedi.mldchan.dev

@luna i first switched from discord to matrix in early 2023, it was a p smooth transition because i wrote a bridge just for that so that the rest of my friends could stay on discord, but eventually most of them actually joined matrix too and the bridge wasnt needed anymore

earlier this year i switched from matrix to xmpp and almost all of my friends switched together with me right away

i think once youve established a certain level of friendship and similar principles its really easy to get people to join your cause and move to a better platform together with you