diff options
Diffstat (limited to 'content/pages')
| -rw-r--r-- | content/pages/pastebin.md | 135 |
1 files changed, 0 insertions, 135 deletions
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 | ``` | ||
