How to be repetitively affirmative: the Unix way

May 28th, 2018 | #terminal

TIL how to be repetitively affirmative: the Unix way.

Read more

You do not have to leave your terminal to consult a calendar

December 24th, 2017 | #terminal

Use case: somebody walks up to you and asks if you can go lunch together on February 2nd. If February 2nd is not a Tuesday, you can. Your are busy in your terminal. You have to consult a calendar to give an answer. Why would you leave your terminal? It is a dangerous world outside your terminal. Just say no.

Just kidding about the dangerous world part, but seriously you do not have to leave your terminal to consult a calendar. TIL you have a built-in calendar in your terminal.

Read more

How du I get the disk size of a directory?

December 23rd, 2017 | #terminal

Typo in the title? Well, not really, because command du displays the disk usage statistics.

$ du -sh /Volumes/WORKSPACE/
 20G    /Volumes/WORKSPACE/
Read more

Mark up matching text when using grep

December 8th, 2017 | #terminal

TIL you can mark up matching text when using grep.

grep --color "pattern_to_match" filename.txt
Read more

Command nohup invokes a utility immune to hangups

December 3rd, 2017 | #terminal

TIL nohup invokes a utility immune to hangups.

nohup [--] utility [arguments]
Read more

Commands whatis and apropos

November 30th, 2017 | #terminal

TIL about the commands whatis and apropos.

$ apropos converter
pdb2mdb(1)               - Program Database to Mono Debugging Symbol converter
CPAN::Meta::Converter(3pm) - Convert CPAN distribution metadata structures
native2ascii(1)          - native to ASCII converter
$ whatis rm
rm(1), unlink(1)         - remove directory entries
git-rm(1)                - Remove files from the working tree and from the index
Read more

Null coalescing operator in C Sharp, PHP, Bash and SQL

November 27th, 2017 | #csharp #php #terminal #sql

TIL about the null coalescing operator in C#, PHP, Bash and SQL. In general, the null coalescing operator returns the result of its first operand—if it exists and is not null.

string siteName = suppliedName ?? "Default Name";

/* is logically equivalent to*/

string siteName = suppliedName != null ? suppliedName : "Default Name";
Read more

Command man prints “gimme gimme gimme” at 00:30

November 22nd, 2017 | #terminal

TIL why the command man print gimme gimme gimme at 00:30. When you run man at 00:30 without specifying the page or with -w, it outputs gimme gimme gimme to stderr.

$ man -w
gimme gimme gimme
/usr/local/share/man:/usr/share/man:/usr/man
Read more

Clear the Secure Enclave if you sell or give away a MacBook Pro with Touch Bar

November 18th, 2017 | #apple #macos #terminal

TIL Apple recommends you to clear the Secure Enclave before you sell or give away a MacBook Pro with Touch Bar.

Read more

Delete local branches that are merged into HEAD and deleted on remote

November 8th, 2017 | #git #terminal

TIL how to delete local branches that are merged into HEAD and deleted on remote.

git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
Read more

How to run JShell on Mac OS X when Java 8 and Java 9 are installed

November 2nd, 2017 | #java #macos #terminal

TIL how to run JShell on Mac OS X when both Java 8 and Java 9 are installed. JShell is one of the new features in Java 9. It is a REPL (Read Evaluate Print Loop) for Java, which evaluates declarations, statements, and expressions as they are entered and immediately shows the results.

Read more

© 2018 Tonny Garić | With from Nijmegen, The Netherlands