diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-05-24 05:57:50 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-05-24 05:57:50 +0200 |
| commit | b3dfbe8b70b870399dc335b8dcf028bb9a3955de (patch) | |
| tree | cd9b9aaa0445d4641356227866827f2d828a1517 /content | |
| parent | 660cebf99b4317856401acda8238bff75f82c4cc (diff) | |
| download | mitjafelicijan.com-b3dfbe8b70b870399dc335b8dcf028bb9a3955de.tar.gz | |
Added notes as a separate type of content and moved the content
Diffstat (limited to 'content')
| -rw-r--r-- | content/notes/catv-weechat-config.md | 19 | ||||
| -rw-r--r-- | content/notes/convert-mkv.md | 20 | ||||
| -rw-r--r-- | content/notes/download-youtube-videos.md | 23 | ||||
| -rw-r--r-- | content/notes/fix-plan9-bootloader.md | 18 | ||||
| -rw-r--r-- | content/notes/git-push-multiple-origins.md | 16 | ||||
| -rw-r--r-- | content/notes/install-plan9port-linux.md | 18 | ||||
| -rw-r--r-- | content/notes/mass-set-permission.md | 14 | ||||
| -rw-r--r-- | content/notes/mount-plan9-over-network.md | 21 | ||||
| -rw-r--r-- | content/notes/plan9-screenshot.md | 16 | ||||
| -rw-r--r-- | content/notes/preview-troff-man-pages.md | 18 | ||||
| -rw-r--r-- | content/notes/run-9front-in-qemu.md | 26 | ||||
| -rw-r--r-- | content/notes/write-iso-usb.md | 13 | ||||
| -rw-r--r-- | content/pages/pastebin.md | 135 |
13 files changed, 222 insertions, 135 deletions
diff --git a/content/notes/catv-weechat-config.md b/content/notes/catv-weechat-config.md new file mode 100644 index 0000000..8d85d22 --- /dev/null +++ b/content/notes/catv-weechat-config.md | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | --- | ||
| 2 | title: "#cat-v on weechat configuration" | ||
| 3 | url: catv-weechat-config.html | ||
| 4 | date: 2023-05-09 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | Set up weechat to connect to #cat-v on oftc. This applies to [weechat](https://weechat.org/) | ||
| 10 | but should be similar for other irc clients. | ||
| 11 | |||
| 12 | ```sh | ||
| 13 | # Install weechat and launch it and execute the following commands. | ||
| 14 | |||
| 15 | /server add oftc irc.oftc.net -tls | ||
| 16 | /set irc.server.oftc.autoconnect on | ||
| 17 | /set irc.server.oftc.autojoin "#cat-v" | ||
| 18 | /set irc.server.oftc.nicks "nick1,nick2,nick3" | ||
| 19 | ``` | ||
diff --git a/content/notes/convert-mkv.md b/content/notes/convert-mkv.md new file mode 100644 index 0000000..cca08d7 --- /dev/null +++ b/content/notes/convert-mkv.md | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | --- | ||
| 2 | title: Convert all MKV files into other formats | ||
| 3 | url: convert-mkv.html | ||
| 4 | date: 2023-05-14 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | You will need `ffmpeg` installed on your system. This will convert all MKV files | ||
| 10 | into WebM format. | ||
| 11 | |||
| 12 | ```sh | ||
| 13 | # Convert all MKV files into WebM format. | ||
| 14 | find ./ -name '*.mkv' -exec bash -c 'ffmpeg -i "$0" -vcodec libvpx -acodec libvorbis -cpu-used 5 -threads 8 "${0%%.mp4}.webm"' {} \; | ||
| 15 | ``` | ||
| 16 | |||
| 17 | ```sh | ||
| 18 | # Convert all MKV files into MP4 format. | ||
| 19 | find ./ -name '*.mkv' -exec bash -c 'ffmpeg -i "$0" c:a copy -c:v copy -cpu-used 5 -threads 8 "${0%%.mp4}.mp4"' {} \; | ||
| 20 | ``` | ||
diff --git a/content/notes/download-youtube-videos.md b/content/notes/download-youtube-videos.md new file mode 100644 index 0000000..dd3363d --- /dev/null +++ b/content/notes/download-youtube-videos.md | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | --- | ||
| 2 | title: Download list of YouTube files | ||
| 3 | url: download-youtube-videos.html | ||
| 4 | date: 2023-05-13 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | If you need to download a list of YouTube videos and don't want to download the | ||
| 10 | actual YouTube list (which `yt-dlp` supports), you can use the following method. | ||
| 11 | |||
| 12 | ```js | ||
| 13 | // Used to get list of raw URL's from YouTube's video tab'. | ||
| 14 | // Copy them into videos.txt. | ||
| 15 | document.querySelectorAll('#contents a.ytd-thumbnail.style-scope.ytd-thumbnail').forEach(el => console.log(el.href)) | ||
| 16 | ``` | ||
| 17 | |||
| 18 | Download and install https://github.com/yt-dlp/yt-dlp. | ||
| 19 | |||
| 20 | ```sh | ||
| 21 | # This will download all videos in videos.txt. | ||
| 22 | yt-dlp --batch-file videos.txt -N `nproc` -f webm | ||
| 23 | ``` | ||
diff --git a/content/notes/fix-plan9-bootloader.md b/content/notes/fix-plan9-bootloader.md new file mode 100644 index 0000000..f37ff0e --- /dev/null +++ b/content/notes/fix-plan9-bootloader.md | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --- | ||
| 2 | title: Fix bootloader not being written in Plan9 | ||
| 3 | url: fix-plan9-bootloader.html | ||
| 4 | date: 2023-05-11 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | If the bootloader is not being written to a disk when installing 9front on real | ||
| 10 | harware try clearing first sector of the disk with the following command. | ||
| 11 | |||
| 12 | ```sh | ||
| 13 | dd if=/dev/zero of=/dev/sdX bs=512 count=1 | ||
| 14 | |||
| 15 | # If command above doesn't work try this one, wait couple of seconds and | ||
| 16 | # press delete key to stop the command. | ||
| 17 | cat </dev/zero >/dev/sd*/data | ||
| 18 | ``` | ||
diff --git a/content/notes/git-push-multiple-origins.md b/content/notes/git-push-multiple-origins.md new file mode 100644 index 0000000..7b12148 --- /dev/null +++ b/content/notes/git-push-multiple-origins.md | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | --- | ||
| 2 | title: Push to multiple origins at once in Git | ||
| 3 | url: git-push-multiple-origins.html | ||
| 4 | date: 2023-05-06 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | Sometimes you want to push to multiple origins at once. This is useful if you | ||
| 10 | have a mirror of your repository on another server. You can do this by adding | ||
| 11 | multiple push urls to your git config. After this you can push to all origins | ||
| 12 | at once by using `git push --all`. This is a shorthand for command above. | ||
| 13 | |||
| 14 | ```sh | ||
| 15 | git config --global alias.pushall '!sh -c "git remote | xargs -L1 git push --all"' | ||
| 16 | ``` | ||
diff --git a/content/notes/install-plan9port-linux.md b/content/notes/install-plan9port-linux.md new file mode 100644 index 0000000..6355287 --- /dev/null +++ b/content/notes/install-plan9port-linux.md | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --- | ||
| 2 | title: Install Plan9port on Linux | ||
| 3 | url: install-plan9port-linux.html | ||
| 4 | date: 2023-05-12 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | Install Plan9port on Linux. This applies to [Plan9port](https://9fans.github.io/plan9port/). | ||
| 10 | This is a port of many Plan 9 programs to Unix-like operating systems. Useful for | ||
| 11 | programs like `9term` and `rc`. | ||
| 12 | |||
| 13 | ```sh | ||
| 14 | sudo apt-get install gcc libx11-dev libxt-dev libxext-dev libfontconfig1-dev | ||
| 15 | git clone https://github.com/9fans/plan9port $HOME/plan9 | ||
| 16 | cd $HOME/plan9/plan9port | ||
| 17 | ./INSTALL -r $HOME/plan9 | ||
| 18 | ``` | ||
diff --git a/content/notes/mass-set-permission.md b/content/notes/mass-set-permission.md new file mode 100644 index 0000000..20a4fab --- /dev/null +++ b/content/notes/mass-set-permission.md | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | --- | ||
| 2 | title: Change permissions of matching files recursively | ||
| 3 | url: mass-set-permission.html | ||
| 4 | date: 2023-05-16 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | Replace `*.xml` with your pattern. This will remove executable bit from all | ||
| 10 | files matching the pattern. Change `+` to `-` to add executable bit. | ||
| 11 | |||
| 12 | ```sh | ||
| 13 | find . -type f -name "*.xml" -exec chmod -x {} + | ||
| 14 | ``` | ||
diff --git a/content/notes/mount-plan9-over-network.md b/content/notes/mount-plan9-over-network.md new file mode 100644 index 0000000..3572b99 --- /dev/null +++ b/content/notes/mount-plan9-over-network.md | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | --- | ||
| 2 | title: Mount Plan9 over network | ||
| 3 | url: mount-plan9-over-network.html | ||
| 4 | date: 2023-05-07 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | - First install libfuse with sudo apt install libfuse-dev. | ||
| 10 | - Then clone https://github.com/ftrvxmtrx/9pfs and compile it with make. | ||
| 11 | - Copy 9pfs to your path. | ||
| 12 | |||
| 13 | ```sh | ||
| 14 | # On Plan9 side | ||
| 15 | ip/ipconfig # enables network | ||
| 16 | aux/listen1 -tv tcp!*!9999 /bin/exportfs -r tmp # export tmp folder | ||
| 17 | |||
| 18 | # On Linux side | ||
| 19 | 9pfs 172.18.0.1 -p 9999 local_folder # mount | ||
| 20 | umount local_folder # unmount | ||
| 21 | ``` | ||
diff --git a/content/notes/plan9-screenshot.md b/content/notes/plan9-screenshot.md new file mode 100644 index 0000000..88b7bd9 --- /dev/null +++ b/content/notes/plan9-screenshot.md | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | --- | ||
| 2 | title: Take a screenshot in Plan9 | ||
| 3 | url: plan9-screenshot.html | ||
| 4 | date: 2023-05-10 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | Take a screenshot in Plan9. This applies to [Plan9](https://9p.io/plan9/) and | ||
| 10 | [9front](https://9front.org/). This will take a screenshot of the screen and | ||
| 11 | output it to `/dev/screen`. You can then use `topng` to convert it to a png | ||
| 12 | image. | ||
| 13 | |||
| 14 | ```sh | ||
| 15 | cat /dev/screen | topng > screen.png | ||
| 16 | ``` | ||
diff --git a/content/notes/preview-troff-man-pages.md b/content/notes/preview-troff-man-pages.md new file mode 100644 index 0000000..6ff1124 --- /dev/null +++ b/content/notes/preview-troff-man-pages.md | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --- | ||
| 2 | title: Previews how man page written in Troff will look like | ||
| 3 | url: preview-troff-man-pages.html | ||
| 4 | date: 2023-05-15 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | Troff is used to write man pages and it is difficult to read it so this will | ||
| 10 | preview how it will look like when it is rendered. | ||
| 11 | |||
| 12 | ```sh | ||
| 13 | # On Linux system. | ||
| 14 | groff -man -Tascii filename | ||
| 15 | |||
| 16 | # On Plan9 system. | ||
| 17 | man 1 filename | ||
| 18 | ``` | ||
diff --git a/content/notes/run-9front-in-qemu.md b/content/notes/run-9front-in-qemu.md new file mode 100644 index 0000000..1e6820d --- /dev/null +++ b/content/notes/run-9front-in-qemu.md | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | --- | ||
| 2 | title: Run 9front in Qemu | ||
| 3 | url: run-9front-in-qemu.html | ||
| 4 | date: 2023-05-05 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | Run 9front in Qemu. This applies to [Plan9](https://9p.io/plan9/) and | ||
| 10 | [9front](https://9front.org/). | ||
| 11 | |||
| 12 | Download from here http://9front.org/iso/. | ||
| 13 | |||
| 14 | ```sh | ||
| 15 | # Create a qcow2 image. | ||
| 16 | qemu-img create -f qcow2 $HOME/VM/9front.qcow2.img 30G | ||
| 17 | |||
| 18 | # Run the VM. | ||
| 19 | qemu-system-x86_64 -cpu host -enable-kvm -m 1024 \ | ||
| 20 | -net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user \ | ||
| 21 | -device virtio-scsi-pci,id=scsi \ | ||
| 22 | -drive if=none,id=vd0,file=$HOME/VM/9front.qcow2.img \ | ||
| 23 | -device scsi-hd,drive=vd0 \ | ||
| 24 | -drive if=none,id=vd1,file=$HOME/VM/ISO/9front.386.iso \ | ||
| 25 | -device scsi-cd,drive=vd1,bootindex=0 | ||
| 26 | ``` | ||
diff --git a/content/notes/write-iso-usb.md b/content/notes/write-iso-usb.md new file mode 100644 index 0000000..04b0c81 --- /dev/null +++ b/content/notes/write-iso-usb.md | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | --- | ||
| 2 | title: Write ISO to USB Key | ||
| 3 | url: write-iso-usb.html | ||
| 4 | date: 2023-05-08 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | Write ISO to USB key. Nothing fancy here. | ||
| 10 | |||
| 11 | ```sh | ||
| 12 | sudo dd if=iso_file.iso of=/dev/sdX bs=4M status=progress conv=fdatasync | ||
| 13 | ``` | ||
diff --git a/content/pages/pastebin.md b/content/pages/pastebin.md deleted file mode 100644 index 422b417..0000000 --- a/content/pages/pastebin.md +++ /dev/null | |||
| @@ -1,135 +0,0 @@ | |||
| 1 | --- | ||
| 2 | title: Pastebin | ||
| 3 | date: 2023-05-19 | ||
| 4 | url: pastebin.html | ||
| 5 | draft: false | ||
| 6 | --- | ||
| 7 | |||
| 8 | *No additional explanation provided here. Use blog for more detailed stuff.* | ||
| 9 | |||
| 10 | **▒ Change permissions of all files matching a pattern recursively** | ||
| 11 | |||
| 12 | ```sh | ||
| 13 | find . -type f -name "*.xml" -exec chmod -x {} + | ||
| 14 | ``` | ||
| 15 | |||
| 16 | **▒ Previews how man page written in Troff will look like** | ||
| 17 | |||
| 18 | ```sh | ||
| 19 | # On Linux system. | ||
| 20 | groff -man -Tascii filename | ||
| 21 | |||
| 22 | # On Plan9 system. | ||
| 23 | man 1 filename | ||
| 24 | ``` | ||
| 25 | |||
| 26 | **▒ Convert all MKV files into WebM format** | ||
| 27 | |||
| 28 | ```sh | ||
| 29 | find ./ -name '*.mkv' -exec bash -c 'ffmpeg -i "$0" -vcodec libvpx -acodec libvorbis -cpu-used 5 -threads 8 "${0%%.mp4}.webm"' {} \; | ||
| 30 | ``` | ||
| 31 | |||
| 32 | **▒ Convert all MKV files into MP4 format** | ||
| 33 | |||
| 34 | ```sh | ||
| 35 | find ./ -name '*.mkv' -exec bash -c 'ffmpeg -i "$0" c:a copy -c:v copy -cpu-used 5 -threads 8 "${0%%.mp4}.mp4"' {} \; | ||
| 36 | ``` | ||
| 37 | |||
| 38 | **▒ Download list of YouTube files** | ||
| 39 | |||
| 40 | ```js | ||
| 41 | // Used to get list of raw URL's from YouTube's video tab'. | ||
| 42 | // Copy them into videos.txt. | ||
| 43 | document.querySelectorAll('#contents a.ytd-thumbnail.style-scope.ytd-thumbnail').forEach(el => console.log(el.href)) | ||
| 44 | ``` | ||
| 45 | |||
| 46 | Download and install https://github.com/yt-dlp/yt-dlp. | ||
| 47 | |||
| 48 | ```sh | ||
| 49 | yt-dlp --batch-file videos.txt -N `nproc` -f webm | ||
| 50 | ``` | ||
| 51 | |||
| 52 | **▒ Install Plan9port on Linux** | ||
| 53 | |||
| 54 | ```sh | ||
| 55 | sudo apt-get install gcc libx11-dev libxt-dev libxext-dev libfontconfig1-dev | ||
| 56 | git clone https://github.com/9fans/plan9port $HOME/plan9 | ||
| 57 | cd $HOME/plan9/plan9port | ||
| 58 | ./INSTALL -r $HOME/plan9 | ||
| 59 | ``` | ||
| 60 | |||
| 61 | **▒ Fix bootloader not being written in Plan9** | ||
| 62 | |||
| 63 | If the bootloader is not being written to a disk when installing 9front on | ||
| 64 | real harware try clearing first sector of the disk with the following command. | ||
| 65 | |||
| 66 | ```sh | ||
| 67 | dd if=/dev/zero of=/dev/sdX bs=512 count=1 | ||
| 68 | |||
| 69 | # If command above doesn't work try this one, wait couple of seconds and | ||
| 70 | # press delete key to stop the command. | ||
| 71 | cat </dev/zero >/dev/sd*/data | ||
| 72 | ``` | ||
| 73 | |||
| 74 | **▒ Take a screenshot in Plan9** | ||
| 75 | |||
| 76 | ```sh | ||
| 77 | cat /dev/screen | topng > screen.png | ||
| 78 | ``` | ||
| 79 | |||
| 80 | **▒ #cat-v on weechat configuration** | ||
| 81 | |||
| 82 | ```sh | ||
| 83 | # Install weechat and launch it and execute the following commands. | ||
| 84 | |||
| 85 | /server add oftc irc.oftc.net -tls | ||
| 86 | /set irc.server.oftc.autoconnect on | ||
| 87 | /set irc.server.oftc.autojoin "#cat-v" | ||
| 88 | /set irc.server.oftc.nicks "nick1,nick2,nick3" | ||
| 89 | ``` | ||
| 90 | |||
| 91 | **▒ Write ISO to USB Key** | ||
| 92 | |||
| 93 | ```sh | ||
| 94 | sudo dd if=iso_file.iso of=/dev/sdX bs=4M status=progress conv=fdatasync | ||
| 95 | ``` | ||
| 96 | |||
| 97 | **▒ Mount Plan9 over network** | ||
| 98 | |||
| 99 | - First install `libfuse` with `sudo apt install libfuse-dev`. | ||
| 100 | - Then clone https://github.com/ftrvxmtrx/9pfs and compile it with `make`. | ||
| 101 | - Copy `9pfs` to your path. | ||
| 102 | |||
| 103 | ```sh | ||
| 104 | # On Plan9 side | ||
| 105 | ip/ipconfig # enables network | ||
| 106 | aux/listen1 -tv tcp!*!9999 /bin/exportfs -r tmp # export tmp folder | ||
| 107 | |||
| 108 | # On Linux side | ||
| 109 | 9pfs 172.18.0.1 -p 9999 local_folder # mount | ||
| 110 | umount local_folder # unmount | ||
| 111 | ``` | ||
| 112 | |||
| 113 | **▒ Push to multiple origins at once in Git** | ||
| 114 | |||
| 115 | ```sh | ||
| 116 | git config --global alias.pushall '!sh -c "git remote | xargs -L1 git push --all"' | ||
| 117 | ``` | ||
| 118 | |||
| 119 | **▒ Run 9front in Qemu** | ||
| 120 | |||
| 121 | Download from here http://9front.org/iso/. | ||
| 122 | |||
| 123 | ```sh | ||
| 124 | # Create a qcow2 image. | ||
| 125 | qemu-img create -f qcow2 $HOME/VM/9front.qcow2.img 30G | ||
| 126 | |||
| 127 | # Run the VM. | ||
| 128 | qemu-system-x86_64 -cpu host -enable-kvm -m 1024 \ | ||
| 129 | -net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user \ | ||
| 130 | -device virtio-scsi-pci,id=scsi \ | ||
| 131 | -drive if=none,id=vd0,file=$HOME/VM/9front.qcow2.img \ | ||
| 132 | -device scsi-hd,drive=vd0 \ | ||
| 133 | -drive if=none,id=vd1,file=$HOME/VM/ISO/9front.386.iso \ | ||
| 134 | -device scsi-cd,drive=vd1,bootindex=0 | ||
| 135 | ``` | ||
