Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Sylvain Pineau
how can I take total minutes from time?
Using date and bash: eval "$(date +'today=%F now=%s')"; midnight=$(date -d "$today 0" +%s);echo "$(((now - midnight) / 60))" Example $ date Fr 10. Jul 08:45:05 CEST 2015 $ eval "$(date +'today=%F now=%s')"; midnight=$(date -d "$today 0" +%s);echo "$(((now - midnight) / 60))" 525 Using date and an the z-shell (zsh): IFS=:; set -- $(date +%T); echo "$((($1 * 3600 + $2 * 60 + $3) / 60))" Example % date Fr 10.
What is `$?` ? Is it a variable?
$? is a special variable in bash that always holds the return/exit code of the last executed command. You can view it in a terminal by running echo $?. Return codes are in the range [0; 255]. A return code of 0 usually means everything is ok. Other values indicate errors. Most applications return 1 or custom values.
Use bash for numeric operation
Another python solution (one -liner).
How do I round numbers to the nearest integer from the command line?
Another python solution (one -liner).
How can I delete text that is NOT in quotes or parentheses?
If you (or someone else with a similar problem who reads this) don't need to preserve the newlines, the following would work: If you need newlines, you can use some tricks, e.g. this: The first adds a to the end of every line. (You could use any character for this.) The second is almost the same as above, but now also matches at the end of a line, so it matches every end of line. The turns newlines into spaces, and dollars into newlines.
command line - What can I do in order to change the ".33" value into "0.33"? - Ask Ubuntu
I want to compare the value against 0 and it tells me that it is less than 0. I used This issue occurs only when "a" is less than "b".
Access individual lines of a text file and create separate text file with that name
Write a Python script for that. I did that for you. Just download it and save it as files.py or similar. You can do that quickly with: wget https://gist.githubusercontent.com/martin-ueding/732de53d573d790f2b32/raw/a7564aa3993f975ef0011b5026b89854558c935f/files.py Then you can start it with python3 files.py text1.txt text2.txt and it will generate all the files you want. And it works with spaces, unlike most other answers!
Launch nautilus in location navigated to in Terminal
I find it rather hard to travel through my system using nautilus and much prefer using the etc commands in Terminal to get around my system, but I find that sometimes I do need to look at a list of files and folders in nautilus as just isn't doing it for me and maybe there is such a large number of files that it would be much simpler if I could just have them all listed in a GUI instead of having to get ls to redirect the output into a file that I would then have to read.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Sylvain
Contact Sylvain, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack