Posts in category “Essays”

网友语录 - 第83期 - 你努力回避的,正是你需要面对和反思的

这里记录我的一周分享,通常在周六或周日发布。


人生可能有的两次觉醒 第一次是弗洛伊德 你明白了,痛苦、自卑、讨好与不安,往往来自童年的匮乏与创伤。你从此不再责备自己。 第二次是阿德勒 你明白了,纵然过去塑造了现在的你,但真正决定自己将来的,是当下的选择。你不再抱怨命运与现实的不公,不再随波逐流,而开始有意识地审视自己的每一个决定。


爽朗君QvQ. 必须学会当面拒绝别人


iklein 你努力回避的,正是你需要面对和反思的。


…more

网友语录 - 第82期 - 人一定要学会两件事,一个是靠自己,一个是为自己。一定要保持独立

这里记录我的一周分享,通常在周六或周日发布。


懒聪 我们终其一生寻找的应该是,自己喜欢的生活和自己本该成为的人。所以多走点弯路没关系,花很多时间在路上也不要紧。只要你一直在成为自己的路上就行。命运的仁慈就在于,只要你往前走,它总是给路


One could say in the first quarter-century of my life, that while I was always fascinated by programming, I could never overcome the guilt of not really knowing whether the tool I am building right now isn’t already superceded by some much better implementation someone else has already written 30 or 40 years ago; I could write a TSV-aware search and replace, or I could find out about awk and solve that entire class of problems in one fell swoop, for example. My central conceit is that this is a trap.

You need to reinvent a couple of wheels to get to the edge of what we know about wheel-making, not a thousand wheels, and not zero; probably four or five is sufficient in most domains, maybe closer to twenty or thirty in the most epistemically rigorous and developed fields like mathematics or computer science. Each wheel you reinvent, and every directed question you ask along the way, will propel you faster to the true frontier than that same amount of time spend in idle study, or even five times that amount.

— Andrew Quinn, footnote on Replacing a 3 GB SQLite database with a 10 MB FST (finite state transducer) binary


Khyines 人一定要学会两件事,一个是靠自己,一个是为自己。一定要保持独立。

fomalhaut 门口摆放的书上写着一句话:“最重要的是你上路了,然后一直往下走。”


THE LESS YOU CARE,
THE MORE YOU LIVE.


Ctrl+Alt+KP 1 这里KP是哪个键?

Claude responded: KP 是 Keypad,就是键盘右边的数字小键盘(NumPad)上的数字键。

KP 是 Keypad,就是键盘右边的数字小键盘(NumPad)上的数字键。

所以 Ctrl+Alt+KP_1 就是 Ctrl + Alt + 小键盘的1,不是主键盘行上方的数字1。

如果你的键盘没有小键盘(比如笔记本),建议直接设成 Ctrl+Alt+1(主键盘数字)就好。


改掉坏习惯的第一步是列出你的坏习惯清单,然后选择一个坏习惯(莫贪心,就一个),设闹钟提醒也罢,让别人督促也罢。坚持逆坏习惯行事。直至无须任何提醒就能下意识的按好习惯行事为止。


每个成年人的脑海中都有一条看不见的线,线外的观点都是“异教邪说”。(刻板印象神圣不可侵犯...虽然这样当然是不对的)


我们不可能掌控所有事,但我们能够控制自己每天怎么过。关键是,人们常常根本不去选择,习惯左右了决大多数人的每一天。只要能有意识的让自己多多养成好习惯,你的人生就是成功的


选择一件每天都能干完的“苦差事”,每天在固定的时间完成它。是什么苦差事不重要,关键在于坚持下去。(可以是洗碗,或者散步,如果膝盖足够好,也可以是跑步,etc....久而久之,你会发现,苦差事其实是并不苦。甚至可以乐在其中....


Our past is not our potential. -- Marilyn Ferguson


警惕:只要有人带你走,你就懒得记路。共产党说领我们闹革命,导致今天的国民能独立思考者甚寡


管埋员 “真正的机会,都是不舒服的,你犹豫,你怀疑,你不敢上。 这才是机会的样子。等你觉得舒服的时候,机会已经变成风险了。 ”

Git alias could run in dash, not bash — even if `/bin/bash` exists

I Wrote a git alias using [[ ... ]] and =~. Works fine in my interactive bash. Run the alias and it explodes:

$ git co master
... Syntax error: "(" unexpected (expecting "then")

First instinct: "but I have bash installed":

$ ls -l /bin/bash
-rwxr-xr-x 1 root root 1298416 ... /bin/bash
$ /bin/bash --version
GNU bash, version 5.2.37(1)-release ...

Doesn't matter. A git alias starting with ! is hardcoded to run under /bin/sh — it doesn't read $SHELL, doesn't care what your login shell is. On Debian/Ubuntu /bin/sh -> dash, and dash doesn't understand [[, =~, == or other bash extensions:

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 ... /bin/sh -> dash
$ echo '[[ "a" == a* ]]' | /bin/sh
/bin/sh: 1: [[: not found

The source is run-command.c::prepare_shell_cmd() in git itself — it literally calls sh -c.

Two fixes:

Wrap in bash -c explicitly (minimal change, but the nested quoting inside an alias gets ugly fast):

co = "!bash -c 'f() { ...bash syntax... }; f \"$@\"' _"

Rewrite as POSIX sh (preferred). Common substitutions:

  • [[ "$x" == -* ]]case "$x" in -*) ... ;; esac
  • [[ "$x" =~ ^HEAD~ ]]case "$x" in HEAD~*) ... ;; esac
  • [[ "$a" == "$b" ]][ "$a" = "$b" ]
  • [[ -f foo ]][ -f foo ] (already POSIX, no reason to use [[)

Lesson: write git aliases as if dash is the only shell on the planet. Don't reach for [[ because it feels nicer — either wrap with bash -c or just use case.

Auto-run startup scripts in Oracle 19c Docker to keep disk clean

Oracle's diagnostic files (trace, incident dumps, listener logs) grow without bound inside the container. If you're running doctorkirk/oracle-19c locally, they'll silently eat your disk.

The fix: mount a startup script into /opt/oracle/scripts/startup/ — this directory runs on every container start (unlike /docker-entrypoint-initdb.d/ which only runs on first database creation).

# docker-compose.yml
volumes:
  - ./startup-scripts:/opt/oracle/scripts/startup
# startup-scripts/init.sh (chmod +x)
#!/bin/bash
echo "=== Oracle startup config starting ==="

# Set ADR purge policies — auto-delete old diagnostic files
adrci <<EOF
set home diag/rdbms/orcl/ORCL
set control (SHORTP_POLICY = 24)
set control (LONGP_POLICY = 48)
set home diag/tnslsnr/$(hostname)/listener
set control (SHORTP_POLICY = 24)
set control (LONGP_POLICY = 48)
EOF
echo "ADR purge policy set: SHORT=24h, LONG=48h"

# Disable listener log (it's huge and rarely needed locally)
lsnrctl set log_status off
echo "Listener logging disabled"

echo "=== Oracle startup config done ==="

SHORTP_POLICY controls how long short-lived files (trace, cdump) are kept. LONGP_POLICY controls incident dumps and core files. 24h/48h is aggressive but fine for a dev environment.

Add echo markers so you can verify it ran: docker compose logs oracle19c | grep "startup config".

One more thing — the diag directory lives in the container's writable layer by default. If Oracle goes haywire (e.g. ORA-600 loop), it can still fill up overlay2 and tank Docker entirely. Mount it out as a safety valve:

- ./oracle-19c/diag/:/opt/oracle/diag

tmux mouse selection not copying to clipboard? Bind MouseDragEnd + MouseUp

With set -g mouse on in tmux, dragging to select text enters copy mode but the selection stays trapped inside tmux — it never reaches the system clipboard. The fix is a two-line binding that pipes the selection through xclip:

# ~/.tmux.conf
set -g mouse on

# Auto-copy on mouse drag end
bind -T copy-mode MouseDragEnd1Pane send -X copy-pipe-and-cancel "xclip -selection clipboard"
# Fallback: also copy on simple mouse-up (covers cases where drag is too short)
bind -T copy-mode MouseUp1Pane send -X copy-pipe-and-cancel "xclip -selection clipboard"

You need xclip installed (sudo apt install xclip). Reload with tmux source-file ~/.tmux.conf.

The copy-pipe-and-cancel does three things at once: grabs the selection, pipes it to xclip -selection clipboard, then exits copy mode (which clears the highlight). That's how you know it worked — the highlight disappearing means the text is in your clipboard.

Why two bindings

MouseDragEnd1Pane only fires on a proper drag. If you click-and-release too quickly, tmux enters copy mode but the drag-end event never fires, leaving the highlight stuck. MouseUp1Pane catches those cases.

When it won't work

If a pane is running an application that captures mouse input (vim, htop, some CLI tools like GitHub Copilot), tmux forwards mouse events to that program and the bindings don't fire. Your fallback in those panes is holding Shift while selecting — that bypasses tmux entirely and uses the terminal emulator's native selection, but it crosses pane boundaries so the text may include content from adjacent panes.