Skip to content

Instantly share code, notes, and snippets.

View MJefferson's full-sized avatar

Martial Jefferson MJefferson

View GitHub Profile
@ddbs
ddbs / dsu.sh
Last active January 24, 2024 13:39
Data Science Ubuntu
# Instructions to build a Data Science VM based on Ubuntu Xenial
######################################
# Pre-requisites
######################################
# Install Virtual Box 5.1+
# https://www.virtualbox.org/
# Install Ubuntu 16.04.1 LTS on VirtualBox
@leommoore
leommoore / mongodb_ssl_with_letsencrypt.md
Last active August 16, 2022 17:35
MongoDB 3.2.x SSL with Letsencrypt

MongoDB 3.2.x SSL with Letsencrypt

Letsencrypt is an initative which aims to increase the use of encryption for websites. It basically allows people to apply for free certificates provided that they prove the they control the requested domain. We will look at the what is needed to secure your MongoDB installation. For more details on setting up a MongoDB server see MongoDB 3.2.x.

Set the hostname

We sould to set the hostname to match the name of the certificate we are going to optain.

sudo hostname mongo0.example.com

Then update the hostname file to set the server name permanently.

@d-akara
d-akara / JavaScriptSafeNavigation.md
Last active April 11, 2024 16:18
JavaScript Safe Navigation

Experimental Safe JavaScript Navigation

Implemented using ES6 Proxies and Symbols

The purpose of this function is to provide a way to avoid deep nested conditionals when traversing a hierarchy of objects. Some languages use an operator such as '?.' to perform this capability. This is sometimes called safe navigation or null conditional operators.

You can somewhat think of this as how a xpath select works. If any nodes along the path are not found, your result is simply not found without throwing an exception and without needing to check each individual node to see if it exists.

Suggestions for improvements welcome!

@jsocol
jsocol / gist:2574884
Created May 2, 2012 07:53
Mongolian + Deferred = Tolerable Mongo in Node
/**
* Imagine, if you will, a simple task. You have a blog written in Node, with
* its content stored in Mongo, and you want to display a single post (for
* simplicity, let's pretend the URL contains the ObjectID) and its comments.
*
* Normally, you'd have to fall into callback/scope hell, and do something
* along the lines of this, already in an onRequest handler:
*/
function displayPost(request, response) {
// We'll look up the post and its comments.