@h12.me

A Single Command to Download a Website

9 April 2017
wget --recursive --level=2 --no-parent --no-clobber --convert-links --continue
[URL]

How to Remove Old Kernels in Ubuntu

10 September 2016
sudo apt install byobu
sudo purge-old-kernels

Reference:

Making Code Block Wrap in Jira

5 September 2016

It is a hack.

Set Jira Administration -> System -> Announcement Banner -> Announcement:

<style type="text/css">
pre {
    white-space: pre-wrap!important;
}
</style>

One-liner to check MongoDB Connections

2 September 2016
mongo --eval "JSON.stringify(db.currentOp(true))" | \
tail -n +3 | \
jq -r .inprog[].client | \
sed 's/\(.*\):.*/\1/' \
| sort | uniq -c | sort -nr
  • dump connection information in standard JSON format
  • remove MongoDB header
  • extract IP:port as a list
  • trim port
  • sort IPs by freqencies

Counting Word Frequencies in One Line

9 August 2016
cat book.txt | \
tr '!()[]{};:",<.>?“”‘’*/\r' ' ' | \
tr ' ' '\n' | \
grep -a -P "^[\p{L}\p{N}\-']+\$" | \
grep -a -P -v "^[\p{N}\-']+\$" | \
sed "s/'s\$//" | \
sed "s/^'//" | sed "s/'\$//" > words.txt

cat words.txt | \
sort | uniq -c | \
sort -nr | \
cut -c9- > words_desc.txt
  • replace punctuations with space; remove \r from `\r\n’
  • one word per line
  • keep only words composed of unicode letters, numbers, hyphen and apostrophe
  • remove pure numbers
  • remove ’s
  • remove starting and ending apostrophe
  • output words.txt

  • sort and count unique words

  • sort by freqency in descending order

  • trim the frequency column

A Note on Mobi Format

3 August 2016

A Manager's FAQ

3 July 2016

This is an insightful list from Henry Ward:

  • How do I get employees to perform better? Tell them what they are doing well.
  • How do I give negative feedback? By being curious.
  • How do I decide what to delegate? Delegate the work you want to do.
  • How should I prioritize? Fix problems. Then prevent problems.
  • How should I grade employees? Don’t. Teach them to self-evaluate.
  • When do I fire somebody? When you know they can’t succeed.
  • How do I fire somebody? By apologizing for our failures.
  • Why can’t I just tell people what to do? Because the more responsibility you have, the less authority you have.
  • How do I know if I am a good manager? Employees ask you for advice.
  • How do I know if I have good management team? Shit rolls uphill.