page

Oct 21, 2021

Get-FileHash - md5sum in Windows

 https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-filehash?view=powershell-7.1&viewFallbackFrom=powershell-6

Get-FileHash - compute hash value of a file

In linux, you can check file hash value with md5sum 

ex: md5sum file

 

In Windows, you can use 'Get-FileHash'

note : you need Microsoft PowerShell to run Get-FileHash. You can launch PowerShell terminal by using VS Code

After launch PowerShell terminal in VS Code,

C:\Documents and Settings> Get-FileHash -Algorithm MD5 test.zip   


Algorithm       Hash                                                        Path
---------       ----                                                             ----
MD5             6CDDB6DBD3DC341AF7FCD56CA8D2B4B8     C:\Documents and Settings\test.zip

Oct 5, 2021

Embeding fonts into PDF file

Somtimes PDF files show scramble fonts. To prevent it, need to embed fonts into PDF files.

how to embed fonts using the Adobe XI Pro (not in Standard) ?

 https://answers.acrobatusers.com/How-I-embed-fonts-Adobe-XI-please-q149712.aspx

 -> Preflight  (Shift+Ctrl+X)

View -> Tools -> Print Production->Preflight -> PDF fixups ->Embed fonts

Jul 23, 2021

xargs command in linux ; xargs vs exec

 Linux and Unix xargs command tutorial with examples

https://shapeshed.com/unix-xargs/

 

xargs
 - command line for building an execution pipeline from standard input.

-  reads items from standard input as separated by blanks and executes a command once for each argument. 

echo 'one two three' | xargs mkdir
ls
one two three
 

xargs vs exec 

The find command supports the -exec option that allows arbitrary commands to be performed on found files. The following are equivalent.

find ./foo -type f -name "*.txt" -exec rm {} \; 

find ./foo -type f -name "*.txt" | xargs rm

So which one is faster? Let’s compare a folder with 1000 files in it.

time find . -type f -name "*.txt" -exec rm {} \; 0.35s user 0.11s system 99% cpu 0.467 total

 time find ./foo -type f -name "*.txt" | xargs rm 0.00s user 0.01s system 75% cpu 0.016 total

Clearly using xargs is far more efficient. In fact several benchmarks suggest using xargs over exec {} is six times more efficient.

 

SuperExactTest :R software package for multi-set intersection test & visualization

Efficient Test and Visualization of Multi-Set Intersections

Scientific Reports volume 5, Article number: 16923 (2015)

https://www.nature.com/articles/srep16923