dashezup's comments

dashezup | 4 years ago | on: Supine Computing (2019)

It's too comfortable while laying down, I usually fell into sleep when I was laying down on my bed to take a rest. I guess this could also happen with such setup.

I think it's better to find a comfortable chair instead, unless you don't have choice but laying down. It's important to keep the laying down pose dedicated to sleeping/resting, do some exercise at other time and this could boost your productivity.

dashezup | 4 years ago | on: Command line tools for productive programmers

I prefer the "git wip" custom command than gitupdate

  git config --global alias.wip "\!git add --all; git commit -a -m \"wip: update\""
  git config --global alias.wtc "\!git add --all; git commit -a -m \"[WTC] \$(curl -s whatthecommit.com/index.txt)\""
I don't like the idea to generate the list of modified files in commit messages, it's not very readable to me plus that I could just generate such info with git log. I tried to write a custom git-wip script to include output of "git status --porcelain=v1" but turns out it's just not necessary since "git log --name-status" could already show it

  git log --name-status
  # or get modified history of a specified file
  git log -p path/to/file.ext

dashezup | 4 years ago | on: Show HN: SQLite query inside a Bash function

True, I don't see the benefits of writing it in bash/shell script in this case. Plus you can get proper syntax highlighting for SQL in your text editor for ".sql" file.

  sqlite3 database.db <query.sql
Some other DBMS have similar things, for MariadDB you could write it in a "
.sql" file as well, setting variables and use it so that you can write a generic sql file. (seems you can't use the variable thing with sqlite3)

  MariaDB> SET @username='UserName@localhost';
  MariaDB> SET @hostname='localhost';
  MariaDB> SOURCE create-user.sql;
Such things is usually cleaner/simpler than writing in bash.

dashezup | 4 years ago | on: Transfer.sh – Easy file sharing from the command line

Haven't use Windows for a while, on macOS I used to use NFS to access files on a LAN server but switched to WebDAV as well because it seems easier and cleaner to use WebDAV compare to SMB/NFS, since it does not require extra services or opened ports on server.

Nowadays I mainly use linux distro, the main use case of accessing files from LAN server is watching movies or TV series. I just create m3u/m3u8 playlist on server and play it through HTTP (not necessarily use WebDAV in this case). this way could avoid potential troubles I could get from mounting a remote directory.

  # LAN server
  ls -1 *.mp4 >playlist.m3u
  # computer, mpv with "save-position-on-quit"
  mpv http://raspberrypi.lan/path/to/playlist.m3u

dashezup | 4 years ago | on: Transfer.sh – Easy file sharing from the command line

I used to self-host transfer.sh, but nowadays I just use WebDAV.

1. it's easy to get WebDAV running, most of HTTP server support it through modules. or you could run it with rclone, on non-standard port or behind a reverse proxy

2. I don't share upload access with others, it's only for my own use. and this way I don't need to deal with huge uploads or illegal contents.

3. I could also just curl it, the uploaded content will have proper mime types. It's convenient for me to share pictures and videos this way on Telegram because it generate previews for me, and it's easy to just copy-paste a link to send to more than one person.

  curl https://user:[email protected]:port/path/to/file.png -T file.png
4. I could use WebDAV for various other cases, such like keeweb instance, Orgzly (android) notes syncing, saving keepass database etc.

Could write a simple shell script to include random characters in the URL, copy url to clipboard etc, such like this one I wrote [1]

btw for plain text, I prefer to use fiche [2] a simple netcat based pastebin. I have a public fiche instance [3] which allow people to upload with bash/zsh/netcat and show webpage with syntax highlighting. Text usually consume very a few of storage and not that "sensitive" like some photos and videos could be, so it's less troublesome to provide a public service for that. I've also write a Telegram bot for easily upload to my pastebin.

Lifespan of my WebDAV uploads and pastes are 1 month, it's very easy to clean them with crontab

  @daily find ~/webdav/tmp -mindepth 1 -maxdepth 1 -type f -ctime +30 -delete
[1] https://ezup.dev/git/dotfiles/file/.local/bin/eztmp.html

[2] https://github.com/solusipse/fiche

[3] https://ezup.dev/p/

dashezup | 4 years ago | on: Apple Music Announces Spatial Audio and Lossless Audio

You would notice that the main difference between lossy and lossless formats is that lossless format keeps all of the stuff while lossy formats partially or wholly drop 20kHz+ if you compare with the spectrogram of them.

And there are good reasons to listen to lossy ones instead of lossless ones, you probably can't hear 20kHz+ sound but it will reduce your headroom if it's there, this especially matters when you play it in high volume because the vibration of the 20kHz+ sound cause could cause audio distortion. MQA is the proprietary audio encoding which deals with such problem, although it seems to be a bit debatable.

Lossless formats are especially important for music storage/archive/remixing. But I really can't hear the difference between opus-128k (vbr), mp3-320k (vbr/cbr) and lossless ones.

I just encode lossless music to opus 128k to listen to when it's possible. opus is a very decent audio format, it's wildly used for VoIP. I wouldn't go any higher than 128k for opus because it's recommended in Opus wiki[1], and I've compared the spectrogram between opus 128k (VBR) and mp3 320k (CBR) and there are only very a few of differences.

[1] https://wiki.xiph.org/Opus_Recommended_Settings

dashezup | 4 years ago | on: Fish shell

Fish is fast but the thing which stops me from keep using it is that fish is not POSIX compliant. so I just use zsh for interactive shell and dash for scripting (and use bash when dash is not enough).

It's easy to configure zsh to be mostly like fish. Here is my zsh setup, I don't use any zsh framework, just install them with my package manager and source related plugins in $HOME/.zshrc.local (except powerlevel10k which I need to clone the repo and source powerlevel10k.zsh-theme)

- grml-zsh-config[1]. lots of useful base stuff

- zsh-completions

- zsh-autosuggestions. fish-like autosuggestions

- zsh-syntax-highlighting. syntax colors

- fzf-key-bindings.zsh / skim-key-bindbings.zsh. fuzzy file/history search

- powerlevel10k. fancy prompt

[1] https://grml.org/zsh/

page 1