💾 Archived View for makeworld.space › one-liners.gmi captured on 2024-03-21 at 14:55:45. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

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:

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 :)