TIL that Spotlight allows us to make calculations, get exchange rates and even the weather. Let’s see a few examples:

  • ceil(), floor() or sqrt()
  • 100USD in CAD
  • Weather Montreal

TIL about configuring a shortcut in iTerm2 to delete a word.

  1. Open the preferences (⌘ + ,) and go to the Keys tab.
  2. Add a shortcut key
  3. In the Action dropdown, select Send Hex Code and input 0x17

TIL about the status bar on iTerm2. It’s pretty useful with a mix of builtin components like Current Directory or git state and user defined variables or functions. To access and configure the status bar go to Preferences > Profiles > Session. Turn on Status bar enabled then click Configure Status Bar.

Again, scripting plays a huge part in how useful the status bar is.

As an example:

# In ~/.bash_profile
function iterm2_print_user_vars() {
  iterm2_set_user_var rubyVersion $(ruby -v | awk '{ print $2 }')

And the variable can be read inside a Custom Action > Configure Component > Configure Action through \(user.rubyVersion).

TIL that curl --data and curl --data-binary when used with a @filename outputs a different result. The most common one being that --data will strip newlines from the file but --data-binary will not.

TIL that in normal mode we can just type a percentage and vim will go there, like 50% or 75%.

TIL about the merkle tree data structure, a tree structure in which each leaf node is a hash of a block of data, and each non-leaf node is a hash of its children.

Label              ROOT
Value           H(H01 + H23)
                 /        \
Label       [H01]         [H23]
Value    H(H0 + H1)     H(H2 + H3)
           /     \        /     \
Label    [H0]   [H1]    [H2]   [H3]
Value    H(A)   H(B)    H(C)   H(D)
           |      |       |      |
           A      B       C      D

It’s mostly used in distributed systems for efficient data verification since it only depends on hashes instead of full files. Bitcoin and Ethereum makes full use of this data structure with variations like the Merkle Patricia Tree.

TIL about the console.group command used to create a new inline group in the Web Console log. It is used in order to create nesting in your console logs.

Let’s see an example:

console.log("This is the outer level");
console.log("Level 2");
console.log("Level 3");
console.warn("More of level 3");
console.log("Back to level 2");
console.log("Back to the outer level");

The generated log will be the following:

"This is the outer level"
  "Level 2"
    "Level 3"
    "More of level 3"
  "Back to level 2"
"Back to the outer level"

TIL about cuckoo filter, a similar algorithm to bloom filters. Both algorithms support fast set membership testing, but cuckoo filters expand on this concept by providing limited counting, deletion and a bounded false positive probability while maintaining a similar space complexity.

cuckoo filters do not play nice with concurrency.

TIL about the uuencode and uudecode command utilities. It allows us to decode and encode binary files respectively.

$ echo 'foo' | uuencode -o my_binary my_binary
$ file my_binary
my_binary: uuencoded or xxencoded text, ASCII text
$ cat my_binary
begin 644 my_binary

$ uudecode my_binary
$ cat my_binary

TIL about quickfix-reflector to make the quickfix window modifiable. I’ve been using it in conjunction with plugins like fzf.vim and async-run that writes to the quickfix window, after that the plugin makes commands like :w and :x reflect the action to every file listed in the quickfix window. It’s a great plugin to enable search and replace, allowing things like replacing words through regular expressions across files in a very convenient way.

Copied to clipboard