Skip to content

Instantly share code, notes, and snippets.


Hengki Sihombing hengkiardo

  • Jakarta, Indonesia
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 Jul 19, 2021
CloudFormation API Gateway endpoint calling a Lambda function using proxy integration example.

CloudFormation API Gateway integration to Lambda function

Template that will create the following:

  • API Gateway:
    • Deployed as a REGIONAL endpoint.
    • Single root method, accepting POST requests only, with Lambda proxy integration to a target function.
  • In-line Python 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.

Machine Learning Week 1 Quiz 2 (Linear Regression with One Variable) Stanford Coursera

Github repo for the Course: Stanford Machine Learning (Coursera)

Question 1

Consider the problem of predicting how well a student does in her second year of college/university, given how well she did in her first year.

Specifically, let x be equal to the number of "A" grades (including A-. A and A+ grades) that a student receives in their first year of college (freshmen year). We would like to predict the value of y, which we define as the number of "A" grades they get in their second year (sophomore year).

jgdoncel / fn_remove_accents.sql
Last active Jun 28, 2021
MySQL Function to remove accents and special characters
View fn_remove_accents.sql
DROP FUNCTION IF EXISTS fn_remove_accents;
CREATE FUNCTION fn_remove_accents( textvalue VARCHAR(10000) ) RETURNS VARCHAR(10000)
SET @textvalue = textvalue COLLATE utf8_general_ci;;
SET @withaccents = 'ŠšŽžÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝŸÞàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿþƒ';
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 Aug 21, 2021
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');