Skip to content

Instantly share code, notes, and snippets.

@piemme
piemme / mongo_search_and_replace.js
Created March 9, 2018 11:49 — forked from rajiteh/mongo_search_and_replace.js
Recursively search and replace a string value across all collections in a mongodb database.
/*
Recursively traverses all collections and objects/arrays contained within documents replacing every
instance of 'find' with 'replace'.
mongo <db_name> mongo_search_and_replace.js
*/
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
@piemme
piemme / nohup-output-to-file.sh
Created February 5, 2018 17:43 — forked from umidjons/nohup-output-to-file.sh
Redirect nohup output to a file
# redirect output and errors into file output.log:
nohup some_command > output.log 2>&1&
# abbreviated syntax for bash version >= ver.4:
nohup some_command &> output.log
@piemme
piemme / README-Template.md
Last active August 27, 2018 16:07 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites