メモ
Table of Contents
- 1. NFS
- 2. Nix
- 3. Haskell
- 4. How to download twitter videos, for Falkon users
- 5. How to watch WNI AU Pay Market streams on desktop
- 6. Japanese announcer names
- 7. Japanese idol and athlete names
- 8. 日本語
- 9. SQL
- 10. Emacs
- 11. git
- 12. wireguard
- 13. network debugging
- 14. VP9 encoding
- 15. Change framerate in ffmpeg without reencoding
- 16. 4chan archivers
- 17. Useful links
- 18. Why pta?
1. NFS
My NFS mounts over wireguard weren't working one day from work, so I ran rpcinfo -p
10.0.0.9
, which should ouput info like this:
program vers proto port service 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100000 4 udp 111 portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 45789 status 100024 1 tcp 36707 status 100005 1 udp 20048 mountd 100005 1 tcp 20048 mountd 100005 2 udp 20048 mountd 100005 2 tcp 20048 mountd 100003 4 tcp 2049 nfs
,but it actually printed out this:
program vers proto port service 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100000 4 udp 111 portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 45789 status 100024 1 tcp 36707 status
Apparently mountd, the actual nfs shares server, wasn't started, so I ssh'd into the
server and ran systemctl stop nfs-server
which finished, but then running systemctl
start nfs-server
failed, so I checked journalctl -xe
and it showed that a systemd mount
unit was failing for one of my disks (maybe it's dead), so I commented it out of my fstab
and ran systemd daemon-reload
. After that, I ran systemd start nfs-server
which worked
this time. Then I checked the output of the rpcinfo
command above and it displayed the
first block, with the mountd
entries. Finally mounting NFS shared works.
2. Nix
2.1. Pitfalls when reinstalling Nix
I'm running the Nix package manager on Arch Linux on a chromebook. The built-in storage is
relatively small and I ran out of disk space when installing the Haskell toolchain. So I
thought the only safe way to recover would be to run Nix's garbage collector, which did
free up disk space, but then on my next attempt at a home-manager switch
, I kept getting
an error about missing "zip" functions or something, and I think non-home-manager Nix
stuff kept working. So I thought maybe the garbage
collector deleted something belonging to home-manager (I installed it as a channel,
following this guide), or maybe the store reference database got corrupted (that's what happened when
I ran out of disk space while using Guix). Reinstalling home-manager didn't fix the
problem, so I decided to reinstall Nix entirely.
I found the official uninstall directions, and just copied and pasted the commands. It
didn't explicitly mention that you need to remove Nix-created files and links from your
home directory, so I cluelessly left those files in place and tried the official install
script and the one from Determinate Systems, but both failed with an error about not
finding a lock file related to my user. I eventually realized it's probably related to the
references to the Nix store and other Nix-created files in my home directory, so I used
find /home/anon -iname '\*nix\*'
to find Nix related stuff besides the harmless config
files under ~/.config
. Then I ran:
rm -rf ~/.local/share/nix/ ~/.cache/nix/ ~/.nix-channels ~/.nix-defexpr ~/.nix-profile
This should remove all artifacts of the previous Nix installation from your home
directory. Now Nix successfully reinstalls. The next hurdle was home-manager not
installing. The error message said something about
~/.local/state/nix/profiles/channels/home-manager
, so I thought "aha, more hidden state
directories/links to the previous Nix store", and I tried removing it but
accidentally removed the entire state directory: ~/.local/state/
. Now on my next
home-manager install attempt, I got:
適切なプロファイル ディレクトリが見つかりませんでした。/home/anon/.local/state/home-manager/profiles と /nix/var/nix/profiles/per-user/anon を試しました
(My locale is set to Japanese for full immersion and forced language learning.) It says it couldn't find these directories. So I created them:
mkdir -p /home/anon/.local/state/home-manager/profiles mkdir -p /nix/var/nix/profiles/per-user/anon # run as root
Finally, home-manager too now installs without error.
Moral of the story is that, yes, Nix and Guix keep everything (packages and their related
files) centrally located in the store and in their database and profile directories under
/var
. This is better than non-functional package managers which spew files all over /etc/,
/bin/, etc.
, without the ability to cleanly roll-back. But conversely, Nix and Guix do
spew stateful data and references to the store into several hidden directories in your
home directory. Remember to remove them if a reinstall is necessary.
Actually, looking back, maybe I didn't run the garbage collector correctly, or maybe I should have tried a roll-back first; not sure if that would have helped in an out-of-disk-space situation, but I'll try it if it happens again.
3. Haskell
3.1. Create a project using Nix
$ nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [ cabal-install ])" --run "cabal init"
Then create default.nix
:
let pkgs = import <nixpkgs> { }; # pin the channel to ensure reproducibility! in pkgs.haskellPackages.developPackage { root = ./.; }
developPackage
source code in pkgs/development/haskell-modules/make-package-set.nix
Build and run the project:
$ nix-build $ ./result/bin/yourprogram
Nix will automatically read the build-depends field in the *.cabal file to get the name of the dependencies and use the haskell packages provided in the configured package set provided by nix.
Details at https://nixos.wiki/wiki/Haskell under "Using developPackage (use the nix packages set for haskell)"
3.2. Add non-haskell nix packages to nix-shell environment
You need to set developPackage's modifier
attribute to a function that takes a
derivation drv
and evaluates pkgs.haskell.lib.addBuildTools drv [extra packages]
.
let pkgs = import <nixpkgs> { }; # pin the channel to ensure reproducibility! in pkgs.haskellPackages.developPackage { root = ./.; modifier = drv: pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages; [cabal-install ghcid]); }
addBuildTools
source code in pkgs/development/haskell-modules/lib/compose.nix
3.3. Books
- Happy Learn Haskell Tutorial
- Functional Programming with Overloading and Higher-Order Polymorphism
- Richard Bird, Jeremy Gibbons Algorithm Design With Haskell Cambridge University Press (2020)
- Category Theory for Programming
- An introduction to category theory and functional programming for scalable statistical modelling and computation
- Applicative Programming with Effects
- Monads for functional programming - University of Edinburgh
- Seven Sketches in Compositionality
4. How to download twitter videos, for Falkon users
Falkon is basically a slimmed down chromium by the KDE project. I use it because its start up time is faster and, most importantly, for it's more minimal UI.
Downloading twitter videos used to be a simple yt-dlp <post-url>
, but now you need to be
signed-in and use the --cookies-from-browser <browser>
option. As of now, there's support
for chromium but not falkon, but since falkon is just reskinned chromium, all you need to
do is cd ~/.config/; ln -s falkon chromium
. This makes a chromium alias for falkon's
config directory. yt-dlp --cookies-from-browser chromium
https://twitter.com/i/status/1693846836724060475
now works since it can find a chromium
config directory. Add --cookies-from-browser chromium
to ~/.config/yt-dlp/config
so
you don't have to write the option on the command line.
Oddly, at least on my system, mpv still can't play twitter videos when given the twitter post url, so you have to download it first with yt-dlp, then run mpv on it.
5. How to watch WNI AU Pay Market streams on desktop
AU Pay tries to make you watch on a phone by refusing to deliver the stream page to desktop browsers, so you have to do the following:
- An anon found a link like this on AU Pay's site. https://wowma.jp/event/live-tv/live.html?id=10213&spe_id=livelp_program.
- Change your desktop browser's user agent string in settings to the first one on this page https://qiita.com/niwasawa/items/21b12f5fd0541837d887. If that link doesn't work just search for "iphone user agent string".
- Visit the stream page from step 1. You'll get the mobile site.
- Find the stream's video player and right click on it. Inspect element.
- Under the HTML5 video element, the source element has the raw .m3u8 stream url.
- Watch that url with mpv or vlc.
- Unset the fake user agent string. This step is necessary because 4chan wouldn't give me a captcha until I did so, and anyways, I would keep getting mobile versions of sites if I didn't.
UPDATE: Firefox and Chromium have easy user agent switches either built-in or as extentions. Also, it seems that https://live.check.tv/live1/index.m3u8 is always the link to the current live stream. Visit https://gg.vern.cc/wn/segment/?n=au%20PAY for links to VODs
6. Japanese announcer names
With notes on how to type their kanji when my input method doesn't suggest the right one.
- ウェザーニュース
- 高安奈緒子 たかやす なおこ ウェザーニューズ所属当時は、旧姓の「角田」(かくた)名義で活動していた
- 高山奈々
- TBS
- 吉村恵里子 よしむら えりこ
- 宇賀神メグ うがじん めぐ
- 田村真子 たむら まこ 政治家の娘 ラヴィット
- 安住紳一郎 あずみ しんいちろう The Time guy
- 南後杏子 なんご きょうこ
- 杉山真也 すぎやま しんや dorky Time guy
- 篠原梨菜 しのはら りな
- 御手洗 菜々 みたらい なな nonchan lookalike
- 冴木柚葉 さえき ゆずは
- 大島璃乃 おおしま りの Yui lookalike
- 高木里代子 たかぎ りよこ ピアノ
- 重松文 しげまつ あや ぶんちゃん
- 皆藤愛子 かいとう あいこ
- 江藤愛 えとう あい
- 小林麗菜 こばやし れいな
- 森田美位子 もりた みいこ ひるおびの元お天気キャスター
- 水谷花那子 みずたに かなこ
- 国本未華 くにもと みか
- テレビ東京
- フジテレビ
- 日本テレビ
- 水卜麻美 みうら あさみ
- 静岡朝日テレビ
- SBS静岡
- 山崎加奈 やまざき かな
- HBC北海道
- 森田絹子 もりた きぬこ
- RBC
- 沖野綾亜 おきの あやあ
- TNC
- 赤木希 あかぎ のぞみ
- NHK
- 近藤奈央 こんどう なおう
- テレビ朝日
- 東海テレビ
- 柴田美奈 しばた みな
- TUY
- 渡部有 わたなべ なお typed ゆう since fctix doesn't have 有 for なお
- ytv
- 羽田優里奈 はだ ゆりな
- 羽田優里奈 はだ ゆりな
- 富山テレビ
- 石川テレビ
- 的場絢香 まとば あやか
- テレQ
- 山形テレビ
- 吉見真叶 よしみ まかなう but without the う
- ABEMA
- フリーアナウンサー
- 名古屋テレビ
- 松崎杏香 まつざき きょうか
- 福島中央テレビ ふくしま ちゅうおう
- 井上千沙 いのうえ ちさ 143センチ、日本一小さいアナウンサー
- 福島テレビ
- 熊谷七海 くまがい ななみ
- 福岡放送
- 檜垣すみれ ひがき すみれ
- セント·フォース
- 辻満里奈 つじ まりな
- 八幡美咲 やはた みさき
- 森 香澄 もり かすみ
- 野村彩也子 のむらさやこ
- 三田友梨佳 みた ゆりか typed ゆうりか
- 田原萌々 たはら もも typed もえ おなじ
- 山本玲奈 やまもとりな
- 鷲見玲奈 すみ れいな
- 良原安美 よしはら あつみ typed あんみ
- 白木莉花 しらき りか
- 足立夏保 あだち かほ
- 望木聡子 もちき さとこ typed ぼうき さとこ because fcitx doesnt have もち for 望
- 今井日奈子 いまい ひなこ
7. Japanese idol and athlete names
- Peel The Apple
- 山崎
- Jams Collection
- 津代美月 つしろ みづき
- レースクイーン
- バドミントン
- 志田千陽 しだ ちはる typed しだ ちひ since fcitx doesn't have 陽 for はる
- バレーボール
- 賀谷 明日光 がや あすみ types あすみつ
- 白岩蘭奈 しらいわ らんな
- 木村沙織 きむら さおり
- 群馬グリーンウイングス
- 白岩蘭奈 しらいわ らんな
- Kanoa 福岡
- 熊本比奈 くまもと ひな
- 大西風歌 おおにし ふか
- モデル
- 吉田恵美 よしだ めぐみ
- グラビア
- 雑
- 桜田莉奈 さくらだ りな idol manager
8. 日本語
- Kiten: Japanese-English dictionary program
- WWWJDIC: Online Japanese Dictionary Service even has a tool for searching by drawing of Kanji
- SVGs and info about Kanji
10. Emacs
10.1. Syntax highlighting in org-mode html output
Nix's Emacs package doesn't come with emacs-htmlize, so add it to your emacs packages list in your home-manager config.
12. wireguard
13. network debugging
nmap -Pn <host> -p 22
to check if ssh is open-T
and-I
options totraceroute
to use TCP and ICMP
14. VP9 encoding
15. Change framerate in ffmpeg without reencoding
https://superuser.com/questions/1689046/ffmpeg-force-re-generate-pts-i-e-alter-frame-rate-without-re-encoding-on-any You can do this using the bitstream filter setts. This also avoids the hassle of writing a raw stream out to a file, then remuxing it. This works because while you can't use normal filters with codec copy (-c:v copy) since they work on the decoded video stream, you can use bitstream filters which work on the encoded stream.
For example to change frame rate to 60 fps, insert
-bsf:v setts=ts=STARTPTS+N/TB_OUT/60
This should set both pts and dts without decoding the stream. If you have a variable frame rate video you may need something like this instead
-bsf:v setts=ts='if(PREV_OUTPTS+9223372036854775808\,PREV_OUTPTS\,STARTPTS)+PREV_OUTDURATION*2'
This modifies the durations of the frame instead of assuming each frame has a constant duration. The odd looking if expression is to ensure the first frame is offset correctly, since PREVOUTPTS is set to -9223372036854775808 (min value of 64-bit int) during the first frame, and we need to replace it with zero.
If you have B-frames, this may mess up decoding since dts may need to be smaller than pts, but it seems to work fine for me anyways. You can try replace setts=ts with setts=pts if you run into trouble. See https://ffmpeg.org/ffmpeg-bitstream-filters.html#setts for details
16. 4chan archivers
- warosu.org has /jp/ and archives the images too
- archived.moe also has /jp/ but doesn't archive the images
- 4plebs.org doesn't have /jp/ but I used it once for /tv/
17. Useful links
- https://youtube-thumbnail-grabber.com/
- well documented js 3d graphics library found on https://ctrl-c.club/~jara25/webjam-23/
- libre implementation of tailscale control server
- tricks for downloading web content
- stenography for imageboards
- cool 4chan tools and stuff. DON'T post coom.tech links in 4chan.
- Joshi Koukousei Captcha Service - The captcha solver made by and for japanese high school girls!
- TUI idol video organizer. Scrapes, stores,and displays metadata. Written in Guile Scheme
- directory to btrfs subvolume
Be careful about posting these links on 4chan. You'll get an automatic 3-DAY BAN for any post that contains "coom.tech". The work-around is to type: https://coom%2etech/ .
18. Why pta?
Fan of idol groups Peel the Apple and Perfume. "ske", after SKE48, would have been a good account name too.
This page is written in emacs's org-mode. Replace .html
with .org
to see the org
source. Last modified 2023-12-27