Latest posts

Luca Lanziani

Read file in chunks in bash

How to read a file in chunks. You can optionally specify the starting point and the chunk size.


function read_file_in_chunks { # FILENAME [START_FROM_LINE] [CHUNK_SIZE]
   FILENAME="$1" && shift
   START_FROM_LINE="$1" && shift || START_FROM_LINE=1
   CHUNK_SIZE="$1" && shift || CHUNK_SIZE=10

   FILE_LINES=$(wc -l < "${FILENAME}")

   while [[ ${FILE_LINE} -le ${FILE_LINES} ]]; do
       CHUNK ...

Luca Lanziani

Post from mobile

Just for fun.

printf("Hello Franco");
printf("Hello Federico");
printf("Hello Enrico");

Luca Lanziani

Browser as notepad

From time to time I need to note something down, from a snippet of code to some lorem ipsum.

Of course I can open a text editor and paste the text there but is it worth it to keep another window around when I have already a browser open in ...