# Patching file with diff and patch

01 September 2018 | 4 min read

# How to do file patch without VCS?

There is a way but it quite complicated and people tend to do mistake when handling lot of files / directory but sometimes developer don’t have connection to VCS and we don’t have any option.. ;d

I face difficult situation during previous project to deploy changes on AIX machine when unlucky we don’t have VPN access to our CVS. I learn something and let me show you the harder way to manage you source code.

# Why do good employees leave?

30 August 2018 | 7 min read

Good employees are usually the first ones to leave. The bad employees are the ones you need to lay off or fire or get rid of somehow. So, why do they leave?

They leave because of one or more of the following reasons:

1. Being underpaid - As an extreme example, an about-to-graduate PhD student that I worked with was offered 67k over the phone. He was ecstatic but when he told his advisor, the advisor told him to call them back and tell them 167k. He was shocked but did as told and the hiring manager agreed on the spot!
I wonder how high the manager was willing to go.

2. Being unappreciated - I know someone who was treated like a leper by the CEO of a startup. This guy was employee. After working there for 3 years, he quit. The company ended up hiring 5 people (including me) to do his job. The CEO was replaced soon afterwards.

# External file changes sync slow: The current inotify limit is too low

25 August 2018 | 1 min read

I get this message when waiting gradle task on my Android Studio 3

External file changes sync may be slow: The current inotify(7) watch limit is too low

WTF is this? After some google-fu , I found some official instruction from JetBrain. You can read here for more details.

Now, let’s check the current setting:

$cat /proc/sys/fs/inotify/max_user_watches 8192 Does the current value are too small? Add new conf file..$ sudo touch /etc/sysctl.d/60-jetbrains.conf

Open the file and add this lines

# Set inotify watch limit high enough for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm).
# Create this file as /etc/sysctl.d/60-jetbrains.conf (Debian, Ubuntu), and
# run sudo service procps start or reboot.
#
# -$man inotify # manpage # -$ man sysctl.conf # manpage
# -$cat /proc/sys/fs/inotify/max_user_watches # print current value in use fs.inotify.max_user_watches = 524288 Let’s restart the systemd$ sudo sysctl -p --system

Now, restart you IDE. It should be no complaint anymore ;d

# Load Git-Bash as terminal on VSCODE

22 August 2018 | 1 min read

Hi there, If you are using VSCODE on Windows and prefer to use Git-Bash instead of Windows CMD as terminal, just add this snipet into your "user-setting" to override the default setting

Then press Ctrl+` to open terminal on your VSCODE

# Finding diff from terminal ouput and hexdumping chars

20 June 2018 | 1 min read

I know how to dump a string and check hex code via piping the output from terminal to hexdump for example :

$echo ‘–allowerasing’ | hexdump -C 00000000 e2 80 98 e2 80 93 61 6c 6c 6f 77 65 72 61 73 69 |......allowerasi| 00000010 6e 67 e2 80 99 0a |ng....| 00000016 But when comes to compare string, I cannot just use diff YY ZZ as like comparing files and I found out using dollar sign$(echo YY) are not acceptable and failed to process but I figure out the workaround, which is to use <(echo ZZ) to create temporary named pipes:

\$ diff <(echo ‘‐‐allowerasing’ | hexdump -C) <(echo ‘–allowerasing’ | hexdump -C)
1,3c1,3
< 00000000  e2 80 98 e2 80 90 e2 80  90 61 6c 6c 6f 77 65 72  |.........allower|
< 00000010  61 73 69 6e 67 e2 80 99  0a                       |asing....|
< 00000019
---
> 00000000  e2 80 98 e2 80 93 61 6c  6c 6f 77 65 72 61 73 69  |......allowerasi|
> 00000010  6e 67 e2 80 99 0a                                 |ng....|
> 00000016