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.
cloud engineer
Here’s a nice little command to open a browser from Bash.
#!/bin/bash open https://domain.com/path/to/web/page/index.html |
#!/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.
Every time I log in to Google Cloud, it’s using the Chromium.
Set BROWSER env to Firefox instead.
export BROWSER=/usr/bin/firefox |
export BROWSER=/usr/bin/firefox
Login to GCP. It should open up Firefox browser instead of Chromium.
gcloud auth login |
gcloud auth login
Add it your .bashrc or .bashprofile if you want it to be permanent.
S3 Browser is a free Windows client for accessing AWS S3 buckets. You can access S3 buckets with an interface similar to File Manager. A typical setup requires that you use access and secret keys to connect to the S3 browser. However, if the server is in the cloud, it’s better that use a machine profile with an assume role. The assume role gets temporary credentials until they expire. They are automatically rotated by AWS behind the scenes for you. This is much safer process than storing key credentials in the cloud. The good news is, S3 Browser support IAM assume roles. Here’s the setup instructions to get your S3 Browser configured using IAM assume role. Here’s IAM role explained.
If you record videos of your desktop, especially the Terminal, it’s a challenge to get your window to fit properly in a 16:9 format. Without the proper tool, eyeballing a window to fit a certain resolution is a difficult task to do.
One of the tools I use to set my window to a resolution that I want is to use my browser as a guide. There are several websites out there that allow you to set your browser to any size or resolution. Head over to resizemybrowser.com. They have several presets in varying resolutions.
If you don’t like any of their presets, then you can create your own. In addition, you can also manually adjust your current window to any size you want. The website gives you feedback of your resolution in real time. Once you set your browser to the right size, then you can match your Terminal with the size of your browser.
Browsers behave differently when it comes to linking media files. Sometimes it will play them directly on the browser. Sometimes it will download them. Each browser seems to have their own rules. So, how do we force all browsers to download media files with just a click of a link.
A simple link like the one below simply won’t work.
<a href="video.mp4">Download</a> |
<a href="video.mp4">Download</a>
One way of forcing downloads is to use a PHP function called readfile.
We have a file below called dl.php. We pass the filename to it, as well as set the path and URL.
$filename = $_GET['file']; $filepath = "http://domain.com/download/"; $url = $filepath.$filename; header("Content-disposition: attachment; filename=".$filename.""); header("Content-type: application/octet-stream"); readfile("".$url.""); |
$filename = $_GET['file']; $filepath = "http://domain.com/download/"; $url = $filepath.$filename; header("Content-disposition: attachment; filename=".$filename.""); header("Content-type: application/octet-stream"); readfile("".$url."");
Our HTML download link will look like this.
<a href="dl.php?file=video.mp4">Download</a> |
<a href="dl.php?file=video.mp4">Download</a>
It’s one way of forcing a download via the PHP route.