-- Leo's gemini proxy

-- Connecting to makeworld.space:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

One-liners


Last updated: 2020-11-23


Newest ones are always at the top, and any one-liner without a source was written by me.



Molly Brown stats


Now that my server uses Molly Brown, here is how the stats are created for the

stats page.


Total number of visits:

wc -l /var/log/molly/access.log | cut -d' ' -f1

Number of unique visitors (by IP):

awk -F'\t' '{ print $2 }' /var/log/molly/access.log | sort | uniq | wc -l


Jetforce stats one-liners


I used to use these on my stats page. You can see the old script here:

/files/jetforce-stats.sh


Note that these assume use of Linux and systemd.


All visits, from first to last:

sudo gzip -dc /var/log/daemon.log.*.gz | sudo cat /dev/stdin /var/log/daemon.log.[0-9] /var/log/daemon.log | grep -a jetforce | awk -F' ' '{ print $6 }' | grep '^[0-9]'

Number of unique visitors:

sudo zgrep -a jetforce /var/log/daemon.log* | awk -F' ' '{ print $6 }' | grep '^[0-9]' | sort | uniq | wc -l

Total number of visits:

sudo zgrep -a jetforce /var/log/daemon.log* | awk -F' ' '{ print $6 }' | grep '^[0-9]' | wc -l

Last server start:

sudo systemctl show jetforce.service -p ExecMainStartTimestamp | cut -b 24-

Explanation:


`zgrep` searches through regular and gzip compressed files, which is helpful because older logs get compressed by default on Debian.

Adding the `-a` flag helps fix an issue I experienced, because apparently some of my logs had binary data. That flag ignores that and tries to search through it anyway.

The awk command grabs just the IP addresses, and then the second grep filters out all the non-IP addresses that were grabbed by accident -- maybe it's was an error line instead, and not a request line, for example. The IP check done by grep is very primitive, but it works well enough for most cases.


These stats are only accurate for as long as your system keeps logs for. Mine seems to keep them for only 7 days, which is likely the Debian default.



C program song


A one-liner that compiles a C program that when run and piped into `aplay`, will play a pretty good song. Make sure to put your volume at like 50%. This is pretty crazy to me, and it sounds good too! Try running it without piping aplay at the end too, to learn a bit more about how it works


echo "g(i,x,t,o){return((3&x&(i*((3&i>>16?\"BY}6YB6$\":\"Qj}6jQ6%\")[t%8]+51)>>o))<<4);};main(i,n,s){for(i=0;;i++)putchar(g(i,1,n=i>>14,12)+g(i,s=i>>17,n^i>>13,10)+g(i,s/3,n+((i>>11)%3),10)+g(i,s/5,8+n-((i>>10)%3),9));}" | gcc -xc -&&./a.out | aplay

Source - I didn't write this one :)

-- Response ended

-- Page fetched on Fri Apr 26 07:54:37 2024