misc tips and tricks

Nowadays, I’ve been used to google searches as a quick way to solve problems. Once in a while, I come across a tip or trick that fixes an issue at hand and then move on. However, I may late on meet a similar problem, but only vaguely remember how I solved it previously. So I’d need to start googling around again. This list is a remedy for such situations, and it will be continuously updated. While the list is created for my own reference, it may also be useful to other viewers of the post, presumably reaching here via google.

  • icdiff — show diff with color
  • scc — strip C comments
  • Taskwarrior (taks) — manage TODO list from terminal
  • httpie as a replacement of curl and wget
  • byebug and pry for debugging Ruby
  • ag to search for PATTERN in source files, replacing grep
  • fd to find files and directories
  • bat to view files with syntax highlighting (in place of cat)
  • exa as an alternative to ls
  • bench to benchmark code
  • asciinema and svg-term to record terminal activity as an SVG animation. Another option is termtosvg. Moreover, the trio ttyrec, ttyplay, ttygif can record, play terminal screen recordings, and convert it into smooth GIF
  • wrk to benchmark HTTP APIs
  • hub — git wrapper for GitHub
  • tail -n +2 to skip the first line (starting from the second line)
  • sudo -i -u user_id, the -i or --login option invokes login shell
  • Understanding Shell Script’s idiom: 2>&1 — redirect ‘stderr’ to ‘stdout’ via ’2>&1’ in bash shell.
  • Ruby one-liners
    • ruby -pi.bak -e "gsub(/SOME_PATTERN/, 'other_text')" files for global replacement of SOME_PATTERN by other_text in files
    • ruby -pe 'gsub(/_/, ".")' globally replace ‘_’ with ‘.’




Thank you for printing this article from http://home.x3dna.org/. Please do not forget to visit back for more 3DNA-related information. — Xiang-Jun Lu