Create Indexes in MongoDB via .NET

static async Task CreateIndexAsync()
{
    var client = new MongoClient();
    var database = client.GetDatabase("HamsterSchool");
    var collection = database.GetCollection<Hamster>("Hamsters");
    var indexKeysDefinition = Builders<Hamster>.IndexKeys.Ascending(hamster => hamster.Name);
    await collection.Indexes.CreateOneAsync(new CreateIndexModel<Hamster>(indexKeysDefinition));
}

References
https://stackoverflow.com/questions/17807577/how-to-create-indexes-in-mongodb-via-net

MongoDB.Driver.MongoAuthenticationException: Unable to authenticate using sasl protocol mechanism SCRAM-SHA-1

The issue is you are authenticating the mongoadmin user for clientdb. But mongoadmin user is authenticated to admin db. Get the mongoadmin user authenticated and then you can access clientdb.

IMongoClient _client;
        public readonly IMongoDatabase _database;

        public MongoContext_URIBased()
        {
            var mongoUrl = new MongoUrl("mongodb://mongoadmin:secret@172.17.103.158:2020/admin");
            _client = new MongoClient(mongoUrl);
            _database = _client.GetDatabase("clientdb");
        }

References
https://stackoverflow.com/questions/53756773/unable-to-connect-to-mongodb-using-authentication-using-mongocsharpdriver-2-7

Assign Output of Shell Command To Variable in Bash

var=$(command-name-here)
var=$(command-name-here arg1)
var=$(/path/to/command)
var=$(/path/to/command arg1 arg2)

OR use backticks based syntax as follows to assign output of a Linux command to a variable:

var=`command-name-here`
var=`command-name-here arg1`
var=`/path/to/command`
var=`/path/to/command arg1 arg2`

Examples

## store date command output to $now  ##
now=$(date)
## alternate syntax ##
now=`date`

To display back result (or output stored in a variable called $now) use the echo or printf command:

echo "$now"
printf "%s\n" "$now"

References
https://www.cyberciti.biz/faq/unix-linux-bsd-appleosx-bash-assign-variable-command-output/

Tweaks for Firefox

Enable Hardware Acceleration

  1. Go to about:preferences
  2. In General, scroll down to Performance
  3. Uncheck the box for Use recommended performance settings
  4. Check the box for Use hardware acceleration when available

Disable Data Collection and Telemetry

  1. Go to about:preferences
  2. Go to Privacy & Security, and scroll down to Firefox Data Collection and Use
  3. Uncheck all boxes in this section
  4. Restart Firefox

Essential About:Config Tweaks

  • Set browser.download.animateNotifications to False
  • Set security.dialog_enable_delay to 0
  • Set network.prefetch-next to False (Only on slow internet connections)
  • Set browser.newtabpage.activity-stream.feeds.telemetry to false
  • Set browser.newtabpage.activity-stream.telemetry to false
  • Set browser.ping-centre.telemetry to false
  • Set toolkit.telemetry.archive.enabled to false
  • Set toolkit.telemetry.bhrPing.enabled to false
  • Set toolkit.telemetry.enabled to false
  • Set toolkit.telemetry.firstShutdownPing.enabled to false
  • Set toolkit.telemetry.hybridContent.enabled to false
  • Set toolkit.telemetry.newProfilePing.enabled to false
  • Set toolkit.telemetry.reportingpolicy.firstRun to false
  • Set toolkit.telemetry.shutdownPingSender.enabled to false
  • Set toolkit.telemetry.unified to false
  • Set toolkit.telemetry.updatePing.enabled to false

Remove Built-in Firefox Add-ons

  • In about:config, set reader.parse-on-load.enabled to False
  • In about:config, set reader.parse-on-load.force-enabled to False
  • In about:config, set browser.pocket.enabled to False
  • In about:config, set loop.enabled to False

References
https://www.makeuseof.com/tag/speed-up-firefox-immediately-with-these-6-simple-tweaks/