You can increase the size of the root EBS volume, but how to make CentOS reflect that change? SSH into the CentOS instance and run the following: $ sudo yum install cloud-utils-growpart $ sudo growpart /dev/nvme0n1 1 $ sudo reboot… Read More
Blog
How to create a host-only VirtualBox network using the command line?
Simple: VBoxManage hostonlyif create I work as a freelancer, so if you don’t want to do that kind of things yourself or don’t have the time, just drop me a line to hire me.
In a Python script, how to change to the directory containing that script?
Code snippet below: import os tmp = os.path.abspath(__file__) tmp = os.path.dirname(tmp) os.chdir(tmp) I work as a freelancer, so if you don’t want to do that kind of things yourself or don’t have the time, just drop me a line to… Read More
How should I tag my AWS resources?
The primary purposes of tags are: To provide human-readable information about the resources As part of automation Filter resources Here are some use cases related to providing human-readable information: Allow a human to semantically understand what a resource is; eg:… Read More
How to use `find` to search for files based on modification time?
To find the files older than 17 days: $ find . -daystart -mtime +17 -print The reason to use `-daystart` is to make things more natural for human beings, because `find` performs some rounding; from the man page: When find… Read More
How to have a dynamic variable name in bash?
Code snippet below: myvar=something varname=myvar echo ${!varname} I work as a freelancer, so if you don’t want to do that kind of things yourself or don’t have the time, just drop me a line to hire me.
How to perform a lock/mutex in bash?
This can be done using the `ln` command: tempfile=$(mktemp ./lock.XXXXXX) lockfile=./lockfile trap "rm $lockfile" EXIT try=1 while ! ln $tempfile $lockfile > /dev/null 2>&1; do try=$[ $try + 1 ] if [[ $try -gt 10 ]]; then echo "ERROR: Timeout… Read More
How to test that an environment variable is set in Bash?
Use this: ${THEVAR:+x} Which will expand to “x” if THEVAR is set and not empty. Alternatively, this test can be used: if [[ ! -v THEVAR ]]; then echo "THEVAR is not set" fi But that will work even if… Read More
What is the VPC flow log format?
When you enable VPC flow logs, records will be created in CloudWatch Logs (or S3 if you choose so, but CloudWatch Logs is definitely better for debugging). There will be one log stream per network interface, and the format of… Read More
What is the best git workflow?
Many people have different opinions on this subject. The best according to me is to have a master branch which contain only deployable commits. Every commit on the master branch could potentially be deployed. Every time you need to add… Read More