Arcane programming magics

From razwiki
Revision as of 05:20, 8 January 2022 by Razzi (talk | contribs) (Created page with "Software development has a high learning curve, in part due to the lack of discoverability of useful features. Here are some useful things that I either learned by accident o...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Software development has a high learning curve, in part due to the lack of discoverability of useful features.

Here are some useful things that I either learned by accident or by somebody else passing on their arcane wisdom to me.

git

  • .git/config is the text file that all the git configuration commands edit, and you can edit by hand.
  • git reflog shows you all git references ever visited; very useful for restoring work thought to be lost.
  • set environment variable GIT_TRACE to see what git is doing when it doesn't do what you'd expect

ssh

  • you can close an unresponsive ssh session with ~.
  • ssh is really hard to get working as intended; add verbosity with ssh -vv <domain> to potentially get an idea of what the program is doing and what you can do

shells

  • exit status 0 is success, so conditionals like if <some command that succeeds> use inverted logic from the usual "if true"
  • you can see the exit status

javascript

  • putting the word debugger in your code will pause at that point if you have devtools open

python

  • in ipython, type a question mark after an object to see some info about it, and 2 question marks to see its source code. Also works in jupyter

routers

  • you can access your router settings at 192.168.0.1 or sometimes 192.168.1.1. If that doesn't work some routers have magic log-in pages that the routers intercept, like router.asus.com

computer hardware

  • there's this battery on your motherboard that keeps the circuit "on" so that low-level settings can be persisted. If you pop it out and put it back in, it will reset your basic computer settings
  • if a laptop won't turn on at all, try disconnecting the battery and connecting it to power. This kept my 2014 macbook air working for years