Skip to content

Instantly share code, notes, and snippets.

View 5orenso's full-sized avatar
More coffee, less code!

Øistein Sørensen 5orenso

More coffee, less code!
View GitHub Profile
'use strict'
var topojson = require('topojson');
var fs = require('fs');
var path = require('path');
var percentile = require('stats-percentile');
var topojsonFilename = path.join(__dirname, 'municipality.topojson');
var csvFilePath = path.join(__dirname, '20161021111834699019927InntektStruk15-utf8.csv');
var outputFile = path.join(__dirname, 'municipality-enriched-2014.topojson');
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

#MongoDB 3.2.x Replica Sets on AWS EC2 A MongoDB replica set provides a mechanism to allow for a reliable database services. The basic replica set consists of three servers, a primary, a secondary and an arbitrator. The primary and secondary both hold a copy of the data. The arbitrator is normally a low spec server which just monitors the other servers and help with the failover process. In production, there can be more than three servers.

To setup mongo as a replica set on Amazon Web Services EC2 you need to first setup a security group with ssh on port 22 and mongodb on port 27017. You then need to create three servers. Select Ubuntu 14.04 LTS x64 and a micro (or bigger depending on your database size, ideally you should have enough memory to match your database size) instance for the primary and secondary and a nano instance for the arbitrator.

##Adjust the File System on each Server The operating system by default will update the last access time on a file. In a high data throughput database application

5orenso /
Created June 18, 2016 10:52 — forked from pkuczynski/
Read YAML file from Bash script
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
// This is a test gist.
function helloWorld() {
console.log('Hello world');

Keybase proof

I hereby claim:

  • I am 5orenso on github.
  • I am sorenso ( on keybase.
  • I have a public key whose fingerprint is E6C3 6599 0B64 86BC C2B0 0273 6311 1595 162D CF90

To claim this, I am signing this object: