Skip to main content

Posts

Showing posts from December, 2020

Notes on old CI 2

 https://stackoverflow.com/questions/41789659/only-variables-should-be-assigned-by-reference-with-function From DotENV $quote        = $value[0];             $regexPattern = sprintf(                     '/^                     %1$s          # match a quote at the start of the value                     (             # capturing sub-pattern used                                   (?:          # we do not need to capture this                                    [^%1$s\\\\] # any character other than a quote or backslash     ...

Notes on daily bash Dec-07 2020

 https://unix.stackexchange.com/questions/42898/find-any-lines-exceeding-a-certain-length Get lines exceeding a certain length. grep '.\{80\}' file perl -nle 'print if length$_>79' file awk 'length>79' file sed -n '/.\{80\}/p' file Get the max length line wc -L brake_input.model.dat Get nth line: sed 'NUMq;d' file If you have NUM in a variable, you will want to use double quotes instead of single: sed "${NUM}q;d" file https://stackoverflow.com/questions/6022384/bash-tool-to-get-nth-line-from-a-file Assuming you need lines 20 to 40, sed -n '20,40p;41q' file_name => not work as expected or awk 'FNR>=20 && FNR<=40' file_name This one work: sed -n -e '10,100p' input.txt > output.txt https://gist.github.com/simofacc/061aaf189a559a0817bf https://stackoverflow.com/questions/13294341/create-slug-to-include-id-and-title-when-insert-record-php-mysql CREATE TRIGGER trigger_name BEFORE INSERT ON tab...

Compare diff tools

Beyond compare seem better than Meld but it not free. Can we use git history (merge, pull request or history change) ? This may possible but suck with big file. => Will try cut file and update result later.  https://github.com/unhammer/diff-large-files => This seem not work, only show normal diff. https://www.tecmint.com/best-linux-file-diff-tools-comparison/ vimdiff seem cool. http://kdiff3.sourceforge.net/ https://www.scootersoftware.com/download.php https://en.wikipedia.org/wiki/PowerShell I'd been driving a bunch of managing changes, and then I originally took the UNIX tools and made them available on Windows, and then it just didn't work. Right? Because there's a core architectural difference between Windows and Linux. On Linux, everything's an ASCII text file, so anything that can manipulate that is a managing tool. AWK, grep, sed? Happy days! I brought those tools available on Windows, and then they didn't help manage Windows because in Windows, everyth...

Lucky Orange customer behaviors recording

 Lucky Orange is a cool tool for tracking customer behaviors. One of the cool use case is to debug website bugs. Sometime tracing user state that lead to bug is very difficult. Tracking user devices and behaviors before bug occur is priceless. While clean my small Ubuntu Vbox, I found that journal log too fat (4GB) so I clean it. https://unix.stackexchange.com/questions/139513/how-to-clear-journalctl Retain only the past two days: journalctl --vacuum-time=2d Retain only the past 500 MB: journalctl --vacuum-size=500M