Simply copy this file in the .idea
folder at the root of your project.
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
pkill -2 mongos && sudo pkill -2 mongod |
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
# Unique lines only (does not work if lines are present more than once in any of the 2 source files) | |
comm -13 <(head -n 1 a.txt && tail -n +2 a.txt | sort) <(head -n 1 b.txt && tail -n +2 b.txt | sort) > compare.txt |
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
/* | |
Shard collection(s) before restoring or mass importing data in them | |
Script has to run against a mongos instance (not mongod), with a user having: | |
- "clusterAdmin" privilege | |
- "readWrite" privilege on database to shard | |
For each collection to shard, you will have to estimate the "numInitialChunks" value depending on : | |
- The volume of data to import/insert | |
- The configured chunks size for your instance |
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
# Mongodump + GPG + S3 | |
# | |
# MDB_HOST is your mongod/s host / IP | |
# MDB_PORT is your mongod/s instance port | |
# MDB_BACKUP_USER is your mongodb backup user with backup/restore role | |
# MDB_BACKUP_PASSWORD is your mongodb backup user password | |
# MDB_AUTHDB is mongodb database used for authentication mechanism | |
# MDB_DB is the dabatase you want to backup | |
# BACKUP_BUCKET is the S3 bucket where you store your backups | |
# GPG_RECIPIENT is the recipient footprint in your GPG recipient list |
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
# Use environment variable as password (could also be a password stored in a file, read with cat) | |
# DO NOT use --password argument in mongodump command or authentication will fail | |
# DO NOT add a file name after --archive argument, or mongodump output won't be sent to stdout | |
# Use S3 infrequent access storage class to reduce cost | |
# Use aes-256 encryption of your file on S3 (or your own KMS keys) | |
# Benefits of this method : | |
# 1 > You won't see the password sent to mongodump using in ps command (it's safe in a multi-user environment) | |
# 2 > You don't have to store the backup locally before sending it to S3 | |
# 3 > Everything is done in one line, fits a cronjob easily |
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
/** | |
* We're going to create an infinite scrollable list. In this case, we're going to show a date. When you swipe left, | |
* you'll see yesterday. Then the day before yesterday, and so on. Swiping right shows you tomorrow, and so on. | |
*/ | |
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
var isAndroid = Ti.Platform.osname === 'android'; | |
/** | |
* Track where we are in the infinite scrollable views, and define how large of a step goes between each view. | |
*/ | |
var currentDate = new Date(), msIntervalBetweenViews = 1000/*ms*/ * 60/*s*/ * 60/*m*/ * 24/*h*/; |