201 private links
A language that compiles to bash
Idea : rewrite it as a rust command :)
That's great to have such simple deployment. Maybe one for rust with such a script or command could be great too.
Or a bash script :)
Because of modularity
How to launch a program without network access?
firejail --noprofile --net=none <program-name>
4kB en Assembleur, ou quelques octets pour les builtins de l'OS
mkdir -p
instead of mkdir
ln -sfn source target
instead of ln -s source target
rm -f example.txt
instead of rm example.txt
Modifying a file
if ! grep -qF "/mnt/dev" /etc/fstab; then
echo "/dev/sda1 /mnt/dev ext4 defaults 0 0" | sudo tee -a /etc/fstab
fi
Check if variable, file or dir exists
formatting a device
mounting a device
touch {hero,lightbox,form,another-component}.njk
Only one same job at a time ?
My solution to deal with this is to bind an IPv6 localhost ::1 socket to a given port. Only one process can do this, and thus it’s a very effective mutex. No lock files to cause havoc, no dealing with the dark and buggy corners of advisory file locking.
For shell scripts, simply replace the #!/bin/sh with #!/somewhere/bin/lock 2048 where 2048 is the port number you will use to enforce the lock (greater than 1024 if you do not want to deal with the hassles of privileged ports).
Using the tool jc to convert the output of a command to JSON.
Takeaways:
- It is possible to list a directory with 8 million files in it.
- strace is your friend
- Don't be afraid to compile code and modify it (hell, simple C compiles so fast it could be interpreted)
- There is no good reason to have 8 million files in a directory :-), but this was a good learning experience (and possibly a good interview question).
The last point is the most important :D
$'$HOME'
expands escape sequences like \n or \'
Do one thing per command and one only. Everything will be fine.
Amend a commit message by ID. A simple script.
Yes 👍
I really enjoy the explanation on how to use pushd and popd to navigate between directories.
After pushd, it is possible de navigate through cd ~n
with n the index of the path in the stack.
cd -
to return to the previous path :)