Skip to content

Instantly share code, notes, and snippets.

@graboskyc
graboskyc / mongomirrorCommand.md
Created February 16, 2020 01:01
mongomirrorCommand
  • Install MongoDB Enterprise Advanced 4.0 using the following commands:

    Purpose Command
    Add MongoDB Public Key wget -qO - https://www.mongodb.org/static/pgp/server-4.0.asc | sudo apt-key add -
    Add MongoDB EA Repo echo "deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu bionic/mongodb-enterprise/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
    Update Apt Package Cache sudo apt-get update
    Install MongoDB EA 4.0.15 sudo apt-get install -y mongodb-enterprise=4.0.15 mongodb-enterprise-server=4.0.15 mongodb-enterprise-shell=4.0.15 mongodb-enterprise-mongos=4.0.15 mongodb-enterprise-tools=4.0.15
  • Edit the MongoDB Enterprise config file by running sudo vi /etc/mongod.etc update the binding, add it to a replica set, and enable username and password auth as shown below or in the sample config.

@alirussell
alirussell / is_british_summertime.js
Last active April 15, 2024 09:25
Check for british summer time (BST) in JavaScript
function lastSunday(month, year) {
var d = new Date();
var lastDayOfMonth = new Date(Date.UTC(year || d.getFullYear(), month+1, 0));
var day = lastDayOfMonth.getDay();
return new Date(Date.UTC(lastDayOfMonth.getFullYear(), lastDayOfMonth.getMonth(), lastDayOfMonth.getDate() - day));
}
function isBST(date) {
var d = date || new Date();
var starts = lastSunday(2, d.getFullYear());
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...