Regex Search Lines Add Quotes

Regex to search a whole file and if the line contains the search word, add beginning and ending quotes. I in this case doing it vi(m). This works to add beginning and ending quotes to ALL lines in the file :%s/^(.*)$/”\1″/ or simpler :%s/.*/”&” Explanation: By default, a pattern is…

Formulas for bytes and duration

Capturing a couple formulas for future reference. I was using restic backup stats and wanted to convert the time a job ran into hours and minutes. Also convert bytes process to TB. bytes to TB example: total_bytes_processed: 5773378 / 1000000000000 == 1.502888851889 duration to HH:MM example using libre calc:total_duration: 15870.197288027…

AWS Cloudwatch Cron

I was trying to schedule a once a week snapshot of a EBS volume and getting “Parameter ScheduleExpression is not valid“. Turns out I missed something small. If you schedule using a cron expression note this important requirement: One of the day-of-month or day-of-week values must be a question mark…

Oracle OCI CLI Query

Some bash snippets of using –query, jq and interacting with Bash to manipulate into variables. Collect boot volume’s id Collect instance ocid Stop instance and collect the id (or whatever you need from the json) Collect the work-request-id to monitor in a loop after I export a custom image to…