Skip to content

Instantly share code, notes, and snippets.

Hengki Sihombing hengkiardo

  • Jakarta, Indonesia
View GitHub Profile
hengkiardo / gist:f0ee23e91652e9cded68
Created Feb 2, 2016
remove all database mongodb
View gist:f0ee23e91652e9cded68
mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})'
hengkiardo /
Created Feb 2, 2016 — forked from katychuang/
remove mongodb that was installed via brew
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep mongo
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
launchctl remove homebrew.mxcl.mongodb
pkill -f mongod
hengkiardo / mongoose-connection-options.js
Created Jan 23, 2016
MongoLab recommended mongoose connection options. More supported connections for the underlying Node Native driver can be found here:
View mongoose-connection-options.js
// mongoose 4.3.x
var mongoose = require('mongoose');
* Mongoose by default sets the auto_reconnect option to true.
* We recommend setting socket options at both the server and replica set level.
* We recommend a 30 second connection timeout because it allows for
* plenty of time in most operating environments.
var options = { server: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } },
hengkiardo / elasticsearch-docker-script
Created Jan 23, 2016 — forked from mschoch/elasticsearch-docker-script
A script to fix ownership of Elasticsearch data directory (when mounted as a volume in docker), then switch to elasticsearch user and launch elasticsearch
View elasticsearch-docker-script
# fix permissions (wrong if docker mounted volume)
chown -R elasticsearch:elasticsearch /var/lib/elasticsearch
# now switch to elasticsearch user and run in foreground
echo Starting: /usr/share/elasticsearch/bin/elasticsearch -Des.default.config=$CONF_FILE -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=$LOG_DIR -Des.default.path.conf=$CONF_DIR $@
su elasticsearch -s /bin/sh -c "/usr/share/elasticsearch/bin/elasticsearch -Des.default.config=$CONF_FILE -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=$LOG_DIR -Des.default.path.conf=$CONF_DIR $@"
hengkiardo / redis.markdown
Created Sep 24, 2015 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu
View redis.markdown

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

hengkiardo / rot13
Created Apr 16, 2015
Encodes and decodes strings into the ROT13 format (rotation of the 26 characters of the alphabet by 13 positions)
View rot13
String.prototype.rot13 = function(){
return this.replace(/[a-zA-Z]/g, function(c){
return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
cd ~
##If you want to install OpenJDK
#sudo apt-get update
#sudo apt-get install openjdk-8-jre-headless -y
###Or if you want to install Oracle JDK, which seems to have slightly better performance
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
View gist:a8e5b61fb7f4594faa01
#include <unistd.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
#include <mach-o/dyld.h>
main (int argc, char * argv[])
volatile char * library;
const mach_vm_size_t page_size = getpagesize ();
# chkconfig: 35 99 99
# description: Node.js app server script
. /etc/rc.d/init.d/functions

RethinkDB Setup on OSX

This guide will get RethinkDB setup and running with a default configuration on OSX. There is also an option for setting RethinkDB to start at boot time on OSX, and a note on upgrading to a more recent RethinkDB version.

First Installation

Install Homebrew if you don't already have it:

You can’t perform that action at this time.