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
# Grabbing Ubuntu | |
FROM ubuntu | |
# Install MongoDB | |
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 && \ | |
echo "deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse" | tee /etc/apt/sources.list.d/mongodb-enterprise.list && \ | |
apt-get update && \ | |
apt-get install -y mongodb-enterprise && apt-get install -y libgssapi-krb5-2 libsasl2-2 libssl1.0.0 libstdc++6 snmp && \ | |
echo 'manual' | tee /etc/init/mongod.override |
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
function validateLab1 (pipeline) { | |
var aggregations = db.getSiblingDB("aggregations") | |
if (!pipeline) { | |
print("var pipeline isn't properly set up!") | |
} else { | |
var studentSubmission = aggregations.movies.aggregate(pipeline) | |
try { | |
var keys = Object.keys(Object.getPrototypeOf(studentSubmission)).length | |
var batchSize = studentSubmission._batch.length | |
var totalReturned = studentSubmission.itcount() |
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
/* | |
* | |
* Mongo-Hacker | |
* MongoDB Shell Enhancements for Hackers | |
* | |
* Tyler J. Brock - 2013 - 2016 | |
* | |
* http://tylerbrock.github.com/mongo-hacker | |
* | |
* |
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.trim.insertMany([ | |
{ | |
"_id" : ObjectId("59e0d1e8505f76f4acde0609"), | |
"a" : " \t\n\r abc \t\n\r " | |
} | |
{ "_id" : ObjectId("59e4d34cd1fb8f891853bca4"), "a" : "xy" } | |
{ "_id" : ObjectId("59e4e55dd1fb8f891853bca5"), "a" : " " } | |
{ "_id" : ObjectId("59e4e56fd1fb8f891853bca6"), "a" : " " } | |
{ "_id" : ObjectId("59e4e578d1fb8f891853bca7"), "a" : " a " } | |
]) |
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
# Just copy and paste all of the below. This assumes you've downloaded MongoDB to your ~/Downloads directory! | |
mkdir ~/MongoDB && find ~/Downloads -name "mongodb-*.tgz" | \ | |
xargs -I@ tar -C ~/MongoDB -xzvf @ --strip-components 1 && \ | |
printf '\n# MongoDB Setup Begin\nMONGODB="$HOME/MongoDB/bin"\nPATH="$PATH:$MONGODB"\n# MongoDB Setup End\n' \ | |
>> `(find $HOME -maxdepth 1 -type f -name "*.zshrc" -o -name "*.bashrc")` \ | |
&& source `(find $HOME -maxdepth 1 -type f -name "*.zshrc" -o -name "*.bashrc")` |
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
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.box_check_update = false | |
config.vm.synced_folder "shared/", "/shared", create: true | |
config.vm.synced_folder "dataset/", "/dataset", create: true | |
# configuring port forwarding to access vm ports on the host system | |
for i in 27000..27100 | |
config.vm.network :forwarded_port, guest: i, host: i | |
end | |
for i in 30000..30100 |
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
function convertToRoman (num) { | |
let romans = [['I', 'V', 'X'], ['X', 'L', 'C'], ['C', 'D', 'M'], ['M']] | |
function getOutput (number, one, five, ten) { | |
var romanMap = { | |
0: () => ‘’, | |
1: one => `${one}`, | |
2: one => romanMap[1](one) + romanMap[1](one), | |
3: one => romanMap[2](one) + romanMap[1](one), | |
4: (one, five) => romanMap[1](one) + `${five}`, | |
5: (one, five) => `${five}`, |
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
function mergesort (arr) { | |
let totalOperations = 0 | |
// this is just to debounce the logging | |
let timeout | |
function debouncedLog () { | |
clearTimeout(timeout) | |
timeout = setTimeout(() => console.log(`${totalOperations} operations`), 500) | |
} | |
function split (unsorted) { | |
totalOperations++ |
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
function insertionSort(arr) { | |
let totalActions = 0; | |
for (let i = 0; i < arr.length; i++) { | |
totalActions++; | |
let smallestIndex = i; | |
for (let j = i + 1; j < arr.length; j++) { | |
totalActions++; | |
if (arr[j] < arr[smallestIndex]) { | |
smallestIndex = j; | |
totalActions++; |
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
function bubbleSort(arr) { | |
let totalOperations = 0; | |
for (let i = 0; i < arr.length - 1; i++) { | |
totalOperations++; | |
for (let j = 0; j < arr.length - 1 - i; j++) { | |
totalOperations++; | |
if (arr[j] > arr[j + 1]) { | |
let tmp = arr[j + 1]; | |
totalOperations++; | |
arr[j + 1] = arr[j]; |