Working With MongoDB TTL Index
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
/* | |
Creating Asynchronous Readable Stream in NodeJS | |
-------------------------------------------------------- | |
When data is pushed asynchronously to internal buffer, you'll get an asynchronous | |
behaviour of the stream. | |
See Synchronous Version: https://gist.github.com/hassansin/7f3250d79a386007ce45 | |
*/ | |
var Readable = require("stream").Readable; |
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
FORMAT: 1A | |
HOST: https://api-sandbox.foxycart.com | |
# FoxyCart | |
# FoxyCart API Root [/] | |
## API starting point [GET] | |
+ Request |
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
# Ref: http://wiki.mikejung.biz/Sysbench | |
# CPU | |
sysbench --test=cpu --cpu-max-prime=20000 run | |
sysbench --test=cpu --cpu-max-prime=20000 run --num-threads=4 | |
#FILE IO | |
sysbench --test=fileio --file-total-size=4G prepare | |
sysbench --test=fileio --file-total-size=4G --file-test-mode=rndrw --max-time=300 --max-requests=0 --file-extra-flags=direct run | |
sysbench --test=fileio --file-total-size=4G cleanup |
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
license: gpl-3.0 | |
height: 300 | |
border: no |
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
db.collection.createIndex( { orderDate: 1, zipcode: -1 }, {background: true} ) | |
db.events.ensureIndex( { "timestampISO": 1 }, { expireAfterSeconds: 120*24*60*60 } ) // <3.0, TTL index, 120day retention period | |
db.collection.getIndexes() //get all indexes | |
db.collection.dropIndex("name"); //drop single index | |
db.collection.dropIndexes(); //drop all indexes | |
db.collection.find({ email: '[email protected]' }).explain("executionStats") // <3.0 : https://docs.mongodb.org/manual/reference/method/cursor.explain/#cursor.explain | |
//https://docs.mongodb.org/manual/tutorial/measure-index-use/ | |
db.collection.explain("executionStats").find({ email: '[email protected]' }) // 3.0 + | |
db.events.totalIndexSize() // in bytes, should not exceed RAM |
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
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac |
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
#!/usr/bin/env node | |
/** | |
* Send a Joke to your mobile using AWS SNS service | |
* Usage: | |
* ./send.js phoneNumber [firstName] [lastName] | |
* | |
*/ | |
const http = require('http'); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://cdn.jsdelivr.net/lodash/4/lodash.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/2.1.3/benchmark.min.js"></script> | |
</head> | |
<body> |