Skip to content

Instantly share code, notes, and snippets.

View hengkiardo's full-sized avatar

Hengki Sihombing hengkiardo

  • Jakarta, Indonesia
View GitHub Profile
@hengkiardo
hengkiardo / wiredtiger-zlib.conf
Created February 2, 2016 11:02 — forked from tmcallaghan/wiredtiger-zlib.conf
YAML Config for MongoDB 3.0.0 - wiredtiger zlib
storage:
dbPath: "./data"
directoryPerDB: true
journal:
enabled: true
engine: "wiredTiger"
wiredTiger:
engineConfig:
cacheSizeGB: 8
journalCompressor: zlib
@hengkiardo
hengkiardo / gist:f0ee23e91652e9cded68
Created February 2, 2016 09:53
remove all database mongodb
mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})'
@hengkiardo
hengkiardo / remove_brew-mongo_osx.sh
Created February 2, 2016 09:03 — forked from katychuang/remove_brew-mongo_osx.sh
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
hengkiardo / mongoose-connection-options.js
Created January 23, 2016 14:48
MongoLab recommended mongoose connection options. More supported connections for the underlying Node Native driver can be found here: http://mongodb.github.io/node-mongodb-native/driver-articles/mongoclient.html#mongoclient-connect-options
// 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
hengkiardo / elasticsearch-docker-script
Created January 23, 2016 10:07 — 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
#!/bin/sh
# 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.data=/var/lib/elasticsearch -Des.default.path.work=/tmp/elasticsearch -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.data=/var/lib/elasticsearch -Des.default.path.work=/tmp/elasticsearch -Des.default.path.conf=$CONF_DIR $@"
@hengkiardo
hengkiardo / redis.markdown
Created September 24, 2015 15:23 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

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
hengkiardo / rot13
Created April 16, 2015 06:45
Encodes and decodes strings into the ROT13 format (rotation of the 26 characters of the alphabet by 13 positions)
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);
});
};
@hengkiardo
hengkiardo / es.sh
Last active August 29, 2015 14:18 — forked from Globegitter/es.sh
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
#include <unistd.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
#include <mach-o/dyld.h>
int
main (int argc, char * argv[])
{
volatile char * library;
const mach_vm_size_t page_size = getpagesize ();
@hengkiardo
hengkiardo / app.sh
Last active August 29, 2015 14:14 — forked from anonymous/app.sh
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js app server script
#
. /etc/rc.d/init.d/functions
USER="root"