added what i forgot yesterdar

main
senka 8 months ago
commit 3a484cd147

2
.gitignore vendored

@ -2,3 +2,5 @@
*.json
/logs
book.html
/log-books
log-books/all.txt

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

@ -0,0 +1,16 @@
#!/bin/ash
if test -f "/mnt/onboard/tldr/all.txt"; then
echo "all.txt exists., remove it";
rm /mnt/onboard/tldr/all.txt
fi
wget -nc "https://hub.xpub.nl/chopchop/tl-dr/log-books/all.txt" -O /mnt/onboard/tldr/all.txt
while read line; do
if test -f "/mnt/onboard/tldr/$line"; then
echo "$line exists."
else
wget "https://hub.xpub.nl/chopchop/tl-dr/log-books/${line}" -O "/mnt/onboard/tldr/${line}"
fi
done < /mnt/onboard/tldr/all.txt

Binary file not shown.

@ -0,0 +1,17 @@
all.txt
log_2024-03-25_162717.epub
log_2024-03-25_162734.epub
log_2024-03-25_163412.epub
log_2024-03-25_170707.epub
log_2024-03-25_170802.epub
log_2024-03-25_170901.epub
log_2024-03-25_171001.epub
log_2024-03-25_171101.epub
log_2024-03-25_172728.epub
log_2024-03-25_172758.epub
log_2024-03-25_180001.epub
log_2024-03-25_180106.epub
log_2024-03-25_180117.epub
log_2024-03-25_180817.epub
log_2024-03-25_181225.epub
log_2024-03-25_182616.epub

@ -0,0 +1 @@
<h1>this is the preface</h1>

@ -0,0 +1,498 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon" sizes="180x180" href="">
<meta name="author" content="html makers">
<meta name="description" content="">
<meta name="keywords" content="">
<meta property="og:type" content="">
<meta property="og:title" content="">
<meta property="og:image" content="">
<meta property="og:description" content="">
<meta property="og:url" content="">
<title>A log book</title>
</head>
<body>
<header>
<h1>TL;DR</h1>
<h2>too log didn't read (on the webquilt)</h2>
</header>
<article>
<h2>What happened today?</h2>
<pre><em>tldr@chopchop:~ $</em>sudo journalctl -S today -u kitchen-stove.service -u
kitchen-bin.service -u kitchen-fridge.service -r -n</pre>
<pre><em>tldr@chopchop:~ $</em>uptime -s</pre>
<p>2024-03-18 07:51:34</p>
<span class="annotation fn-annotatation" level="1">
This is common, the
fragility of these machines are more prominant than any cloud user expects. Partially because of scale,
partially because a lot of labour that happen in datacenters just escapes us all when we want to just upload
an image.
</span>
<pre><em>tldr@chopchop:~ $</em>sudo journalctl _COMM=useradd -r -n 1 --output-fields=MES</pre>
<p>Mar 19 15:00:26 chopchop useradd[16047]: new user: name=chef, UID=1023, GID=1023, home=/home/chef, shell=/bin/bash, from=/dev/pts/3
</p>
<span class="annotation fn-annotatation" level="2">
Users will be trusted with not just the keys and passwords to the "house" which is the server, but with a
portion of responsibility to keep it afloat and contribute to what makes it a community of practices (and
network of knowledge and dependence).
</span>
<pre><em>tldr@chopchop:~ $</em>sudo journalctl -S today _COMM=useradd -r</pre>
<span class="annotation fn-annotatation" level="1">
A level 1 annotation for users_created_today
</span>
<pre><em>tldr@chopchop:~ $</em> grep 'install' /var/log/dpkg.log</pre>
<ul>
<li>2024-03-10 15:16:14 install libtk8.6:armhf <none> 8.6.13-2</li>
<li>2024-03-10 15:16:15 install tk8.6-blt2.5:armhf <none> 2.5.3+dfsg-4.1</li>
<li>2024-03-10 15:16:15 install blt:armhf <none> 2.5.3+dfsg-4.1</li>
<li>2024-03-10 15:16:15 install python3-tk:armhf <none> 3.11.2-3</li>
<li>2024-03-12 14:29:01 install python3-markupsafe:armhf <none> 2.1.2-1</li>
<li>2024-03-12 14:29:02 install python3-jinja2:all <none> 3.1.2-1</li>
<li>2024-03-15 09:51:48 install libhttp-parser2.9:armhf <none> 2.9.4-5</li>
<li>2024-03-15 09:51:48 install libmbedx509-1:armhf <none> 2.28.3-1</li>
<li>2024-03-15 09:51:48 install libmbedtls14:armhf <none> 2.28.3-1</li>
<li>2024-03-15 09:51:48 install libgit2-1.5:armhf <none> 1.5.1+ds-1+deb12u1</li>
<li>2024-03-15 09:51:49 install bat:armhf <none> 0.22.1-4</li>
<li>2024-03-19 10:38:35 install fonts-font-awesome:all <none> 5.0.10+really4.7.0~dfsg-4.1</li>
<li>2024-03-19 10:38:35 install python3-dateutil:all <none> 2.8.2-2</li>
<li>2024-03-19 10:38:36 install ghp-import:all <none> 2.1.0-3</li>
<li>2024-03-19 10:38:36 install libjs-popper.js:all <none> 1.16.1+ds-6</li>
<li>2024-03-19 10:38:36 install libjs-bootstrap4:all <none> 4.6.1+dfsg1-4</li>
<li>2024-03-19 10:38:36 install libjs-highlight.js:all <none> 9.18.5+dfsg1-2</li>
<li>2024-03-19 10:38:37 install libjs-lunr:all <none> 2.3.9~dfsg-2</li>
<li>2024-03-19 10:38:37 install libjs-modernizr:all <none> 2.6.2+ds1-5</li>
<li>2024-03-19 10:38:37 install libjs-sizzle:all <none> 2.3.6+ds+~2.3.3-2</li>
<li>2024-03-19 10:38:37 install python3-tornado:armhf <none> 6.2.0-3</li>
<li>2024-03-19 10:38:38 install python3-livereload:all <none> 2.6.3-2</li>
<li>2024-03-19 10:38:38 install python3-colorama:all <none> 0.4.6-2</li>
<li>2024-03-19 10:38:38 install python3-click:all <none> 8.1.3-2</li>
<li>2024-03-19 10:38:38 install python3-joblib:all <none> 1.2.0-4</li>
<li>2024-03-19 10:38:39 install python3-regex:armhf <none> 0.1.20221031-1</li>
<li>2024-03-19 10:38:39 install python3-tqdm:all <none> 4.64.1-1</li>
<li>2024-03-19 10:38:39 install python3-nltk:all <none> 3.8-1</li>
<li>2024-03-19 10:38:40 install python3-lunr:all <none> 0.6.2-2</li>
<li>2024-03-19 10:38:40 install sphinx-rtd-theme-common:all <none> 1.2.0+dfsg-1</li>
<li>2024-03-19 10:38:40 install python3-markdown:all <none> 3.4.1-2</li>
<li>2024-03-19 10:38:40 install python3-mergedeep:all <none> 1.3.4-3</li>
<li>2024-03-19 10:38:40 install python3-yaml:armhf <none> 6.0-3+b1</li>
<li>2024-03-19 10:38:41 install python3-pyyaml-env-tag:all <none> 0.1-3</li>
<li>2024-03-19 10:38:41 install python3-watchdog:all <none> 2.2.1-1</li>
<li>2024-03-19 10:38:41 install mkdocs:all <none> 1.4.2+dfsg-2</li>
<li>2024-03-19 10:38:41 install node-jquery:all <none> 3.6.1+dfsg+~3.5.14-1</li>
<li>2024-03-19 10:38:42 install python3-argcomplete:all <none> 2.0.0-1</li>
<li>2024-03-19 10:38:42 install python3-userpath:all <none> 1.8.0-1</li>
<li>2024-03-19 10:38:42 install pipx:all <none> 1.1.0-1</li>
<li>2024-03-19 10:38:42 install python3-pyinotify:all <none> 0.9.6-2</li>
<li>2024-03-19 10:38:43 install python3-simplejson:armhf <none> 3.18.3-1</li>
<li>2024-03-19 10:42:57 install libjs-term.js:all <none> 0.0.7-4</li>
<li>2024-03-19 10:42:57 install python3-ptyprocess:all <none> 0.7.0-5</li>
<li>2024-03-19 10:42:57 install python3-terminado:all <none> 0.17.0-1</li>
<li>2024-03-19 10:42:57 install python3-xstatic:all <none> 1.0.0-7</li>
<li>2024-03-19 10:42:58 install python3-xstatic-term.js:all <none> 0.0.7.0-4</li>
</ul>
<pre><em>tldr@chopchop:~ $</em> grep 'remove' /var/log/dpkg.log</pre>
<ul>
<li>2024-03-15 09:55:52 startup packages remove</li>
<li>2024-03-15 09:55:52 remove bat:armhf 0.22.1-4 <none></li>
</ul>
<pre><em>tldr@chopchop:~ $</em>sudo journalctl _COMM=systemd-login
--output-fields=MESSAGE -S today -g "New session" | grep -v 'Boot'</pre>
<ul>
</ul>
<pre><em>tldr@chopchop:~ $</em>sudo journalctl _COMM=groupadd -r --output-fields=MESSAGE</pre>
<ul>
</ul>
<pre><em>tldr@chopchop:~ $</em>sudo journalctl _COMM=groupremove -r --output-fields=MES</pre>
<ul>
</ul>
<pre><em>tldr@chopchop:~ $</em>sudo journalctl _COMM=usermod -r</pre>
<ul>
</ul>
<pre><em>tldr@chopchop:~ $</em>sudo journalctl _COMM=userdel -r</pre>
<ul>
</ul>
<hr />
<pre><em>tldr@chopchop:~ $</em>sudo service --status-all</pre>
<ul>
<li>[ - ] alsa-utils</li>
<li> [ - ] apparmor</li>
<li> [ + ] atop</li>
<li> [ + ] atopacct</li>
<li> [ + ] bluetooth</li>
<li> [ - ] console-setup.sh</li>
<li> [ + ] cron</li>
<li> [ + ] cups</li>
<li> [ + ] cups-browsed</li>
<li> [ + ] dbus</li>
<li> [ + ] dphys-swapfile</li>
<li> [ + ] exim4</li>
<li> [ + ] fake-hwclock</li>
<li> [ - ] fcgiwrap</li>
<li> [ - ] hwclock.sh</li>
<li> [ - ] incron</li>
<li> [ - ] keyboard-setup.sh</li>
<li> [ + ] kmod</li>
<li> [ + ] networking</li>
<li> [ - ] nfs-common</li>
<li> [ + ] nginx</li>
<li> [ - ] paxctld</li>
<li> [ - ] php7.4-fpm</li>
<li> [ + ] php8.2-fpm</li>
<li> [ + ] procps</li>
<li> [ - ] pulseaudio-enable-autospawn</li>
<li> [ + ] raspi-config</li>
<li> [ + ] rng-tools-debian</li>
<li> [ - ] rpcbind</li>
<li> [ - ] rsync</li>
<li> [ - ] saned</li>
<li> [ + ] ssh</li>
<li> [ - ] sudo</li>
<li> [ + ] triggerhappy</li>
<li> [ + ] udev</li>
<li> [ - ] uuidd</li>
<li> [ - ] x11-common</li>
</ul>
<pre><em>tldr@chopchop:~ $</em>getent group</pre>
<ul>
<li>root:x:0:</li>
<li>daemon:x:1:</li>
<li>bin:x:2:</li>
<li>sys:x:3:</li>
<li>adm:x:4:xpub</li>
<li>tty:x:5:</li>
<li>disk:x:6:</li>
<li>lp:x:7:aleevadh,bernabereit,lorenzo,mania,mszw,mxrwho,river,senak,thijsoid,v,vitrinekast,wang,xpub,xpub,zerozeta,zz1,www-data</li>
<li>mail:x:8:</li>
<li>news:x:9:</li>
<li>uucp:x:10:</li>
<li>man:x:12:</li>
<li>proxy:x:13:</li>
<li>kmem:x:15:</li>
<li>dialout:x:20:xpub,mb,river,joak,aleevadh,bernabereit,lorenzo,mania,mszw,mxrwho,river,senak,thijsoid,v,vitrinekast,wang,xpub,zerozeta,zz1,murtaugh,mb</li>
<li>fax:x:21:</li>
<li>voice:x:22:</li>
<li>cdrom:x:24:xpub</li>
<li>floppy:x:25:</li>
<li>tape:x:26:</li>
<li>sudo:x:27:joak,aleevadh,bernabereit,lorenzo,mania,mszw,mxrwho,river,senak,thijsoid,v,vitrinekast,wang,xpub,zerozeta,zz1,murtaugh,mb,strt,cristina,chipchip,killer</li>
<li>audio:x:29:xpub,river,pulse,vitrinekast,liquidsoap</li>
<li>dip:x:30:</li>
<li>www-data:x:33:vitrinekast</li>
<li>backup:x:34:</li>
<li>operator:x:37:</li>
<li>list:x:38:</li>
<li>irc:x:39:</li>
<li>src:x:40:</li>
<li>gnats:x:41:</li>
<li>shadow:x:42:</li>
<li>utmp:x:43:</li>
<li>video:x:44:xpub</li>
<li>sasl:x:45:</li>
<li>plugdev:x:46:xpub</li>
<li>staff:x:50:</li>
<li>games:x:60:xpub</li>
<li>users:x:100:xpub,murtaugh,aleevadh,h4ck3r,mania,mszw,mxrwho,senak,v,wang,zerozeta,bernabereit,lorenzo,mb,river,thijsoid,vitrinekast,zz1,joak,cristina,strt,chipchip,killer,chef</li>
<li>nogroup:x:65534:</li>
<li>systemd-journal:x:101:</li>
<li>systemd-network:x:102:</li>
<li>systemd-resolve:x:103:</li>
<li>input:x:104:xpub</li>
<li>kvm:x:105:</li>
<li>render:x:106:xpub</li>
<li>crontab:x:107:</li>
<li>netdev:x:108:xpub</li>
<li>systemd-timesync:x:109:</li>
<li>messagebus:x:110:</li>
<li>bluetooth:x:112:</li>
<li>avahi:x:113:</li>
<li>spi:x:999:xpub</li>
<li>i2c:x:998:xpub</li>
<li>gpio:x:997:xpub</li>
<li>systemd-coredump:x:996:</li>
<li>xpub:x:1000:</li>
<li>vitrinekast:x:1001:</li>
<li>senak:x:1002:</li>
<li>lorenzo:x:1003:</li>
<li>mxrwho:x:1004:</li>
<li>bernabereit:x:1005:</li>
<li>river:x:1006:</li>
<li>v:x:1007:</li>
<li>mania:x:1008:</li>
<li>aleevadh:x:1009:</li>
<li>h4ck3r:x:1010:</li>
<li>thijsoid:x:1011:</li>
<li>mszw:x:1012:</li>
<li>zerozeta:x:1013:</li>
<li>wang:x:1014:</li>
<li>zz1:x:1015:</li>
<li>Debian-exim:x:114:</li>
<li>rtkit:x:115:</li>
<li>murtaugh:x:1017:</li>
<li>mb:x:1016:</li>
<li>pulse:x:116:</li>
<li>pulse-access:x:117:</li>
<li>mlocate:x:118:</li>
<li>uuidd:x:119:</li>
<li>joak:x:1018:</li>
<li>sgx:x:120:</li>
<li>plocate:x:121:</li>
<li>polkitd:x:995:</li>
<li>_ssh:x:111:</li>
<li>pipewire:x:122:</li>
<li>cristina:x:1019:</li>
<li>strt:x:1020:</li>
<li>incron:x:123:</li>
<li>chipchip:x:1021:</li>
<li>killer:x:1022:</li>
<li>tcpdump:x:124:</li>
<li>liquidsoap:x:125:</li>
<li>lpadmin:x:126:river,xpub</li>
<li>ssl-cert:x:127:</li>
<li>scanner:x:128:saned</li>
<li>saned:x:129:</li>
<li>colord:x:130:</li>
<li>chef:x:1023:</li>
</ul>
</article>
<script src="https://issue.xpub.nl/23/quilt/quilt.js" data-cutFileName="false" data-wholeUrl="false"></script>
<link rel="stylesheet" type="text/css" href="https://issue.xpub.nl/23/quilt/quilt.css">
<script type="text/javascript" src="script.js"></script>
</body>
</html>

@ -5,7 +5,7 @@ import os
import fnmatch
#create the log directory
path = "./logs"
path = "/home/xpub/www/html/tl-dr/logs"
if not os.path.exists(path):
os.makedirs(path)
# TODO: check sorting of these files (should be chronological)
@ -15,6 +15,12 @@ now = datetime.today()
next_report = now + timedelta(hours=3)
log_file_name = "log_" + now.strftime("%Y-%m-%d_%H:%M:%S") + ".html"
def create_all_logs_file():
list_logs = subprocess.run(["ls", "/home/xpub/www/html/tl-dr/log-books"], capture_output=True)
with open("/home/xpub/www/html/tl-dr/log-books/all.txt", "w") as f:
print(list_logs.stdout.decode('UTF-8').strip(), file=f)
# Execute a command on the command line. Based = used for piped commands
def run_command(command, based = False):
result = subprocess.run(command, capture_output=True, input=based)
@ -54,7 +60,7 @@ kitchen_services = run_command(["sudo", "journalctl", "-S", "today", "-u", "kitc
# loading the jinja template environment
print("Filling the template");
env = Environment(loader=FileSystemLoader("templates"))
env = Environment(loader=FileSystemLoader("/home/xpub/www/html/tl-dr/templates"))
# loading the template (use template.jinja when generating the html webview)
template = env.get_template("book.jinja")
@ -91,11 +97,12 @@ output = template.render(
print("Output the files");
# Export the html as book.html, which is used as an input for pandoc
with open("book.html", "w") as f:
with open("/home/xpub/www/html/tl-dr/book.html", "w") as f:
print(output, file=f)
subprocess.run(["pandoc", "book.html", "-o", "logged_book.epub", "-c", "print.css", "--metadata", "title="+log_file_name], capture_output=True)
subprocess.run(["pandoc", "/home/xpub/www/html/tl-dr/book.html", "-o", "/home/xpub/www/html/tl-dr/logged_book.epub", "-c", "print.css", "--metadata", "title="+log_file_name, "--epub-cover-image=cover.jpg" ,"--epub-embed-font='fonts/Cascadia/ttf/CascadiaCode-*.ttf'" "--epub-embed-font='fonts/Ductus/Ductus*.woff'"], capture_output=True)
print("just generated a new book, also put it in the backlog of logs")
subprocess.run(["cp", "logged_book.epub", "log-books/log_" + now.strftime("%Y-%m-%d_%H:%M:%S") + ".epub"], capture_output=True)
subprocess.run(["cp", "/home/xpub/www/html/tl-dr/logged_book.epub", "/home/xpub/www/html/tl-dr/log-books/log_" + now.strftime("%Y-%m-%d_%H%M%S") + ".epub"], capture_output=True)
create_all_logs_file();
print("Finished");
# At the moment, we are not storing logs in the log folder anymore

Loading…
Cancel
Save