open browser in bash

Here’s a nice little command to open a browser from Bash. #!/bin/bash open https://domain.com/path/to/web/page/index.html You can use this command to open a web page from your script.

November 30, 2022 · 1 min · ulysses

bash any key

Here’s the script to add pauses in your Bash script. echo "please wait until web page loads ... " read -p "Press any key to continue... " -n1 -s You can also put it inside a function and call it multiple times. function press_any_key { echo "please wait until web page loads ... " read -p "Press any key to continue... " -n1 -s } press_any_key

November 29, 2022 · 1 min · ulysses

crontab on macos monterey

A recent OS upgrade rendered the crontab to malfunction on macOS Monterey. It turned out the system just needed a reset of System Preferences > Security & Privacy > Privacy tab, and to make sure cron has full access to disks. Once you flipped that, your crontab should start working. Hope that helps.

November 29, 2022 · 1 min · ulysses

crop factor calculator

If you’re into photography, you would know what crop factor means. I have a Nikon D90 camera with a crop factor of 1.5. For example, if you use a 24mm full frame lens on a D90, the focal length will be 36mm. So, here’s a handy bash script that calculates the crop factor by multiplying the full frame focal length by 1.5. #!/bin/bash if [ $# -eq 0 ] then echo "Usage: cropfactor.sh 24" exit fi a=$(echo "1.5 * $1" | bc) echo "Cropfactor focal length is: " $a"mm." Result ...

November 13, 2022 · 1 min · ulysses

bulk ffmpeg resize

Here’s how to resize videos and pictures using FFMPEG. Bulk Resize Pictures for filename in *.JPG; do ffmpeg -i "$filename" -vf scale=-1:720 final/"$filename"; done Bulk Resize Video and Create Thumbnail for filename in *.MP4; do ffmpeg -i "$filename" -s 1080x720 -pix_fmt yuv420p -crf 18 "$filename".mp4; ffmpeg -ss 00:00:00 -i "$filename" -vframes 1 "$filename".jpg; done

October 31, 2022 · 1 min · ulysses

vim cheatsheet

Almost all are not able to remember all the shortcuts that are available for the vi or vim editor. I will call it vim throughout this article. There are several cheatsheets out there, but the one that works for me is the one provided by rtorr in Github. I use the cheatsheet often. I suggest that you start small. At the very least learn how to navigate in vim. Once you feel comfortable doing that, you can learn other advanced shortcuts such as editing, search and replace, working with multiple files and many much more. I hope you’ll find the cheatsheet as helpful as it has done for me. Again if you missed the link above, I posted it below. ...

October 27, 2022 · 1 min · ulysses

ffmpeg resize

How to resize JPEG using FFMPEG. ffmpeg -i TREE.JPG -y -vf scale=iw*.2:ih*.2 tree.jpg Another option is to set resolution. ffmpeg -i TREE.JPG -y -vf scale=-1:720 tree.jpg How to resize video using FFMPEG. ffmpeg -i TREE.MP4 -s 640x360 -pix_fmt yuv420p -crf 18 tree.mp4 How to create a thumbnail from a video. ffmpeg -ss 00:00:00 -i tree.mp4 -vframes 1 tree.jpg

October 25, 2022 · 1 min · ulysses

vim colors

I had trouble getting my vi editor to display all black background color. This includes the background color after the end of the file. I just wanted an all black background for better visibility. I did a little bit of googling and found this nice little gem. I happen to like the dessert theme and went with that instead of the recommended mustang theme which I don’t have installed. Hope you’ll find this helpful. ...

October 25, 2022 · 1 min · ulysses

git remove files from repo after commit

If you need to remove files from a repo after committing, use … Remove file git rm --cached file.ext Push to repo git push

October 4, 2022 · 1 min · ulysses

install cockpit on rocky 9

Cockpit is a web-based graphical interface for Linux users and admins. Install dnf install cockpit Start and Enable systemctl start cockpit systemctl enable cockpit.socket Status systemctl status cockpit Web access http://192.168.0.20:9090

October 3, 2022 · 1 min · ulysses