Skip to content

Instantly share code, notes, and snippets.

Hengki Sihombing hengkiardo

  • Jakarta, Indonesia
Block or report user

Report or block hengkiardo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
peterc / pg_available_extensions.txt
Created Feb 14, 2019
Which Postgres extensions are available on DigitalOcean's new managed PostgreSQL service?
View pg_available_extensions.txt
defaultdb=> SELECT * FROM pg_available_extensions;
name | default_version | installed_version | comment
aiven_extras | 1.0.2 | | aiven_extras
plpgsql | 1.0 | 1.0 | PL/pgSQL procedural language
btree_gist | 1.5 | | support for indexing common datatypes in GiST
tcn | 1.0 | | Triggered change notifications
seg | 1.3 | | data type for representing line segments or floating-point intervals
pgrowlocks | 1.2 |
magnetikonline /
Last active Feb 8, 2020
CloudFormation example for an API Gateway endpoint calling a Lambda function using proxy integration.

CloudFormation example for API Gateway integration to Lambda function

Template that will create the following:

  • API Gateway endpoint:
    • A single root method, accepting POST requests only with Lambda proxy integration to a function.
  • In-line Lambda function echoing back requesting users IP address to API Gateway requests:
    • IAM role for Lambda allowing CloudWatch logs access.
    • Permissions for Lambda that allow API Gateway endpoint to successfully invoke function.
  • CloudWatch logs group for Lambda, with 90 day log retention.

After standing up the template, you should be able to curl a POST request to the URL listed as the apiGatewayInvokeURL output value.

View livesync.js
* This script will automatically sync all updates from one database to another. It is meant to be run while
* syncing the database using mongodump and mongorestore.
* Example:
* node livesync.js mongodb://<user>:<pass> \
* mongodb://<user>:<pass> \
* app-production \
* mongodb://<user>:<pass>

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
eladnava /
Last active Mar 28, 2020
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
# Make sure to:
# 1) Name this file `` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x
# 7) Test it out via ./
virajkulkarni14 /
Last active Apr 5, 2020
Installing Cassandra 3.5 on Mac OS X El Capitan

Installing Cassandra on Mac OS X


Version Number might change!! The versions of all softwares mentioned here, including Cassandra will change as newer versions are launched.

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

apanimesh061 /
Last active May 26, 2018
mongo-connector with ES 2.2.0 and Mongo 2.6

Before starting please have a mongo replica set initiated. I have mongo running at localhost:27170 and elasticsearch at localhost:9200

The test dataset I used is available on the mongodb website.

I am using MongoDB 2.6 and Elasticsearch 2.2.0 on a Windows machine.

Here I have tested three cases:

  • An index already exists, mc-test-index in this case
View cpuprofiler.js
* Simple userland CPU profiler using v8-profiler
* Usage: require('[path_to]/CpuProfiler').init('datadir')
* @module CpuProfiler
* @type {exports}
var fs = require('fs');
var profiler = require('v8-profiler');
karmi / .gitignore
Last active Apr 7, 2020
Example Nginx configurations for Elasticsearch (
View .gitignore
hkhamm /
Last active Mar 31, 2020
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL"
You can’t perform that action at this time.