lower to upper vice versa

How to convert uppercase to lowercase and vice versa. upper_project=$(echo "$project" | tr '[:lower:]' '[:upper:]') Vice versa lower_project=$(echo "$project" | tr '[:upper:]' '[:lower:]') Display output echo $upper_project echo $lower_project

September 11, 2024 · 1 min · ulysses

fixing apache errors

I was getting an Apache error on startup and during a restart after upgrading to Linux Mint 22. As it turned out, the module that’s enabled is php8.1. It should be 8.3. Here’s the fix: sudo a2dismod php8.1 sudo systemctl restart apache2 This did the trick, but I was getting another error during restarting services. The error says “could not reliably determin the server fully qualified domain.” Here’s the fix for that. ...

August 4, 2024 · 1 min · ulysses

git undo last commit

How to undo git’s last commit. git reset --soft HEAD~ Undo the last 2 commits. git reset --soft HEAD~2 Undo local changes. git reset --hard abcd543

June 12, 2024 · 1 min · ulysses

pulseaudio auto start

I’m trying to figure out why my audio is not automatically starting on Linux. After some trial and error, here’s the fix. Edit the /etc/pulse/client.conf file. vi /etc/pulse/client.conf Change “autospawn=no” to “autospawn=yes.” autospawn=yes Make sure to take out ‘;’ or ‘#" to remove the comment. pulseaudio --start Once you modified the file, restart pulseaudio. pulseaudio --start Reboot your machine to check if audio is working on boot. If that doesn’t work, delete the cookie. ...

June 4, 2024 · 1 min · ulysses

linux mint dummy output

Somehow I lost my audio devices in Linux Mint. Instead, the only audio device present in the system is the ‘dummy output.’ Googling for answers was not clear cut. After many trials and errors I was able to get my sound fixed. Here are the commands I took to get my audio devices back in the fold in Linux Mint. Your mileage may vary. First, validate your sound devices are still present or being recognized on your system. ...

May 26, 2024 · 1 min · ulysses

gcp exit serial console

How to exit gracefully from GCP’s serial console. Type on the keyboard tilde followed by dot. ~. That would be tilde followed by a dot.

April 11, 2024 · 1 min · ulysses

bash function comments

Here’s a good way to add comments to a Bash function. ############################################################ # Function : calculate_average # Description : Calculates the average of a list of numbers. # Parameters : List of numbers separated by spaces # Returns : The average value of the input numbers ############################################################ calculate_average() { ... } ############################################################ # Function : calculate_sum # Description : Calculates the sum of a list of numbers. # Parameters : List of numbers separated by spaces # Returns : The sum value of the input numbers ############################################################ calculate_sum() { ... }

April 5, 2024 · 1 min · ulysses

add to crontab with no duplicate

How to add to a crontab without creating duplicates. crontab -l | grep 'myscript.sh' || (crontab -l 2>/dev/null; echo "45 10 * * * /path/to/myscript.sh") | crontab -

March 17, 2024 · 1 min · ulysses

diff files in two directories

Here’s a good way to compare two directories to see if both directories contain similar files. This is essential if you want to combine two directories into one. diff -qr dir1 dir2 | sort

March 7, 2024 · 1 min · ulysses

timestamp timezone conversion

Here’s a function that will convert a timestamp from one timezone to another, in this case from UTC to ET timezone. Get a list of snapshots list_snapshots() { volume_name="$1" snapshots=$(gcloud compute snapshots list --filter="sourceDisk=$volume_name" --format="value(name,creationTimestamp.date('%s'))") while read -r snapshot; do snapshot_name=$(echo "$snapshot" | cut -d' ' -f1) creation_timestamp=$(echo "$snapshot" | cut -d' ' -f2) et_creation_timestamp=$(convert_to_et "$creation_timestamp") echo "Snapshot: $snapshot_name, Creation Time (ET): $et_creation_timestamp" done <<< "$snapshots" } The function to convert to ET timezone. ...

February 24, 2024 · 1 min · ulysses