Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://www.compose.com/articles/finding-duplicate-documents-in-mongodb/ | |
| db.hotels.aggregate([{ $group: { _id: { hid: "$hid" }, uniqueIds: { $addToSet: "$_id" }, count: {$sum: 1} } }, {$match: {count: {"$gt": 1}}}, {$sort: {count: -1}} ]).forEach(function(doc){ db.hotels.remove({ _id: doc.uniqueIds[1] }) }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Digital Ocean Ubuntu 18.04 x64 Droplet with "Regular Intel" CPU. | |
| # Running: | |
| # git clone https://gist.github.com/54fc09734a3911e91eeeb43434f117df.git | |
| # cd 54fc09734a3911e91eeeb43434f117df/ | |
| # chmod +x make-chr.sh | |
| # ./make-chr.sh | |
| # | |
| # Once the reboot is done, login with root/CHANGEME and change the password! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Set up the Heroku scheduler to run this command every hour. See example setup at https://goo.gl/nMCSH3 | |
| # | |
| # Requires env vars to be set in Heroku with `heroku config:set`: | |
| # - HEROKU_APP_NAME: this is just the app name in Heroku, i.e. `heroku apps` will list all apps you have access to | |
| # - HEROKU_CLI_USER: Once Heroku CLI is authenticated (https://goo.gl/Qypr4x), check `cat .netrc` (or `_netrc` on Windows), | |
| # look for `login` under `machine api.heroku.com` | |
| # - HEROKU_CLI_TOKEN: As above, but use the `password` field | |
| # |