Skip to content

Commit 55280de

Browse files
committed
Lots of new articles
- Teams video background on linux - View Outlook calendar in tmux/terminal - Jenkins notes - List all configured Jenkins passwords - Resize Linux disks - How to create a redis cluster - My Linux desktop journey - People that have inspired me (WIP)
1 parent 29d4c2f commit 55280de

13 files changed

+404
-74
lines changed

conf/pelicanconf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
AUTHOR = 'Torstein Krause Johansen'
66
SITENAME = "Skybert's World"
7-
SITEURL = 'http://skybert.net'
7+
SITEURL = 'https://skybert.net'
88
TIMEZONE = 'Europe/Oslo'
99
DEFAULT_LANG = 'en'
1010

Loading

src/graphics/2021/outlook-in-tmux.png

3.16 MB
Loading

src/java/jenkins.md

-48
This file was deleted.

src/java/list-all-configured-passwords-and-secrets-in-jenkins.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
title: List All Configured Passwords and Secrets in Jenkins
22
date: 2021-10-08
33
category: java
4-
tags: java, security
4+
tags: java, security, jenkins
55

66

77
Sometimes, like when you want to migrate an old Jenkins to a new one
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
title: MS Teams Wallpaper on Linux
2+
date: 2021-10-06
3+
category: linux
4+
tags: linux, video
5+
6+
My only envy of Mac and Windows users has been video backgrounds in
7+
[Microsoft
8+
Teams](https://www.microsoft.com/nb-no/microsoft-teams/). Not any
9+
more, thanks to [backscrub](https://github.com/floe/backscrub).
10+
11+
<a href="/graphics/2021/2021-10-07-teams-with-wallpaper.jpg">
12+
<img
13+
class="centered"
14+
src="/graphics/2021/2021-10-07-teams-with-wallpaper.jpg"
15+
alt="teams with wallpaper"
16+
style="width: 1024px"
17+
/>
18+
</a>
19+
20+
You'll need to compile it yourself (which will also compile
21+
Tensorflow).
22+
23+
```bash
24+
$ git clone https://github.com/floe/backscrub.git
25+
$ mkdir build
26+
$ cd build
27+
$ cmake .. && make -j$(nproc)
28+
```
29+
30+
Then, load the kernel module:
31+
32+
```text
33+
# modprobe v4l2loopback \
34+
devices=1 \
35+
max_buffers=2 \
36+
exclusive_caps=1 \
37+
card_label="VirtualCam" \
38+
video_nr=10
39+
```
40+
41+
You'll then be able to choose your background with:
42+
43+
```bash
44+
$ ./build/backscrub \
45+
-c /dev/video0 \
46+
-v /dev/video10 \
47+
-b ~/pictures/wallpapers/foo.jpg
48+
```
49+
50+
In Chrome/Teams/Skype++ you'll then choose `/dev/video10`, which will
51+
show up as `VirtualCam` because of the `card_label` option to
52+
`modprobe` above, instead of `/dev/video0` as the camera input. That's
53+
it.
54+
55+
...well, there is actually another thing you must do: Currently
56+
(2021-10-06), the `eigen` library is down on Gitlab, so before running
57+
`cmake`, you'll have to do:
58+
59+
```bash
60+
$ find -type f |
61+
while read -r f ; do
62+
sed 's#https://gitlab.com/libeigen/eigen#https://gitlab.com/libeigen/eigen-backup#g' "$f";
63+
done
64+
```
65+
66+
Thanks to `backscrub`, I no longer have a thing I miss on Linux ;-)

src/linux/outlook-in-tmux.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
title: Outlook in tmux
2+
date: 2021-11-04
3+
category: linux
4+
tags: linux
5+
6+
<a href="/graphics/2021/outlook-in-tmux.png">
7+
<img
8+
class="centered"
9+
src="/graphics/2021/outlook-in-tmux.png"
10+
alt="outlook in tmux"
11+
style="width: 1024px;"
12+
/>
13+
</a>
14+
15+
Here you see [tmux](https://github.com/tmux/tmux) running showing a
16+
summary of my Outlook agenda. There's also some other nice things that
17+
I like to keep track of, like the time and battery usage.
18+
19+
To get this working, I have done a few things:
20+
21+
## Exporting Outlook calendar as ical
22+
23+
I've gotten a hold of the [.ics
24+
URL](https://fileinfo.com/extension/ics) of my Outlook calendar.
25+
26+
## cron job to convert ical to Org
27+
Since I also want the calendar in Emacs, I convert it to
28+
[.org](https://orgmode.org/) using
29+
[ical2orgpy](https://github.com/asoroa/ical2org.py):
30+
31+
```bash
32+
#! /usr/bin/env bash
33+
34+
# pre-requisite: pip install ical2orgpy
35+
36+
ics_url=https://outlook.office365.com/owa/calendar/[email protected]/235452314/calendar.ics
37+
org_file=$HOME/doc/scribbles/$(date +%Y)/outlook.org
38+
39+
curl -s "${ics_url}" | ~/.local/bin/ical2orgpy - "${org_file}"
40+
```
41+
42+
## Convert the ICS calendar export to something nice looking
43+
44+
I then convert the `outlook.org` into something that looks nice in the
45+
terminal:
46+
47+
```bash
48+
#! /usr/bin/env bash
49+
50+
sleep=3600
51+
52+
create_nice_ascii_agenda() {
53+
grep "$(date --iso)" -B 2 |
54+
sed 's#:RECURRING:##' |
55+
sed 's/-[ ]*$//' | # remove trailing dash and space
56+
sed 's#\*#\n❯#g' |
57+
sed '/^-$/d' | # remove empty lines
58+
sed "s#$(date +'%F %a') ##g" | # remove day abbreviation
59+
sed 's#--# → #' |
60+
xargs | # remove all newlines
61+
sed 's#❯#\n❯#g' | # one entry per line
62+
sed -r 's#❯ (.*) <(.*)> → <(.*)>#\2 → \3 ❯ \1#' | # put time first
63+
sort -u |
64+
cat
65+
}
66+
67+
main() {
68+
while true; do
69+
clear
70+
cat "$HOME/doc/scribbles/$(date +%Y)/outlook.org" |
71+
create_nice_ascii_agenda
72+
sleep "${sleep}"
73+
done
74+
75+
}
76+
77+
main "$@"
78+
```

src/linux/resize-disk.md

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
title: Resizing a disk
2+
date: 2021-11-11
3+
category: linux
4+
tags: linux
5+
6+
7+
First off, check the status of the `/` partition that we want to give
8+
more space:
9+
10+
```text
11+
# df -h /
12+
Filesystem Size Used Avail Use% Mounted on
13+
/dev/sda4 144G 70G 67G 52% /
14+
```
15+
16+
We've then expanded the disk on the hosting platform (Linode, AWS, KVM++) and want to make use of that extra space. For this, we use the partition tool GNU Parted:
17+
18+
19+
```text
20+
# parted /dev/sda
21+
GNU Parted 3.2
22+
Using /dev/sda
23+
Welcome to GNU Parted! Type 'help' to view a list of commands.
24+
(parted) p
25+
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 734003200 blocks) or continue with the current setting?
26+
Fix/Ignore? Fix
27+
Model: VMware Virtual disk (scsi)
28+
Disk /dev/sda: 537GB
29+
Sector size (logical/physical): 512B/512B
30+
Partition Table: gpt
31+
Disk Flags:
32+
33+
Number Start End Size File system Name Flags
34+
1 1049kB 2097kB 1049kB bios_grub
35+
2 2097kB 1076MB 1074MB ext4
36+
3 1076MB 3223MB 2147MB linux-swap(v1)
37+
4 3223MB 161GB 158GB ext4
38+
39+
(parted) resizepart 4
40+
Warning: Partition /dev/sda4 is being used. Are you sure you want to continue?
41+
Yes/No? yes
42+
End? [161GB]? 537GB
43+
```
44+
45+
Now we can ask `parted` to print the new partition table to verify
46+
it's what we'd expect it to be:
47+
48+
```text
49+
(parted) p
50+
Model: VMware Virtual disk (scsi)
51+
Disk /dev/sda: 537GB
52+
Sector size (logical/physical): 512B/512B
53+
Partition Table: gpt
54+
Disk Flags:
55+
56+
Number Start End Size File system Name Flags
57+
1 1049kB 2097kB 1049kB bios_grub
58+
2 2097kB 1076MB 1074MB ext4
59+
3 1076MB 3223MB 2147MB linux-swap(v1)
60+
4 3223MB 537GB 534GB ext4
61+
62+
(parted) q
63+
Information: You may need to update /etc/fstab.
64+
```
65+
66+
## Resize the file system to use the new space
67+
68+
```text
69+
# df -h /
70+
Filesystem Size Used Avail Use% Mounted on
71+
/dev/sda4 144G 70G 67G 52% /
72+
```
73+
74+
Then resize it:
75+
```text
76+
# resize2fs /dev/sda4
77+
resize2fs 1.44.1 (24-Mar-2018)
78+
Filesystem at /dev/sda4 is mounted on /; on-line resizing required
79+
old_desc_blocks = 19, new_desc_blocks = 63
80+
The filesystem on /dev/sda4 is now 130285051 (4k) blocks long.
81+
```
82+
83+
Now, verify that the space is actually used as intended:
84+
```text
85+
# df -h /
86+
Filesystem Size Used Avail Use% Mounted on
87+
/dev/sda4 489G 70G 397G 15% /
88+
```
89+
90+
Now that's a much larger disk!
91+
92+
## Checking /etc/fstab
93+
94+
```text
95+
# cat /etc/fstab
96+
UUID=86935d45-9ba5-11e8-877f-0050569be994 none swap sw 0 0
97+
UUID=87b2c106-9ba5-11e8-877f-0050569be994 / ext4 defaults 0 0
98+
UUID=86935d44-9ba5-11e8-877f-0050569be994 /boot ext4 defaults 0 0
99+
```
100+
101+
Verify that the UUID of the `/` partition that we resized somehow hasn't changed:
102+
```text
103+
# blkid | grep sda4
104+
/dev/sda4: UUID="87b2c106-9ba5-11e8-877f-0050569be994" TYPE="ext4" PARTUUID="09fa4b97-c549-44d6-b498-a3117264b445"
105+
```
106+
107+
As you can see, the `UUID` corresponds to what it's in `/etc/fstab`.
108+
109+

src/talks/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/torstein/src/talks

src/unix/creating-a-redis-cluster.md

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ will create 3 masters and 3 replicas. This means Redis has _some_
5353
redundancy, but if both the master and its replica goes down, the
5454
other nodes will not be able to recover the data.
5555

56+
If you download the Redis source code, you can find a [script that
57+
does all of this for
58+
you](https://github.com/redis/redis/blob/unstable/utils/create-cluster)
59+
(but what's the fun in that 😉).
60+
5661
## Writing data on one node and retrieving it from another
5762

5863
```bash

0 commit comments

Comments
 (0)