Skip to content

Instantly share code, notes, and snippets.

@sanggiChoi
sanggiChoi / create_proximity.sh
Created March 20, 2018 01:58 — forked from bonzanini/create_proximity.sh
Elasticsearch Proximity/Phrase Search
curl -XDELETE http://localhost:9200/test/articles
curl -XPUT http://localhost:9200/test/_mapping/articles -d '{
"properties": {
"content": {
"type": "string",
"position_offset_gap": 100
}
}
}'
@sanggiChoi
sanggiChoi / create_index.sh
Created March 20, 2018 01:59 — forked from bonzanini/create_index.sh
Elasticsearch/Python test
curl -XPOST http://localhost:9200/test/articles/1 -d '{
"content": "The quick brown fox"
}'
curl -XPOST http://localhost:9200/test/articles/2 -d '{
"content": "What does the fox say?"
}'
curl -XPOST http://localhost:9200/test/articles/3 -d '{
"content": "The quick brown fox jumped over the lazy dog"
}'
curl -XPOST http://localhost:9200/test/articles/4 -d '{
@sanggiChoi
sanggiChoi / install.sh
Created July 16, 2018 04:44 — forked from bbenson29/install.sh
Install terraform and packer on Centos 7
#!/bin/bash
set -x
TERRAFORM_VERSION="0.9.11"
PACKER_VERSION="1.0.2"
# install pip
pip install -U pip && pip3 install -U pip
if [[ $? == 127 ]]; then
wget -q https://bootstrap.pypa.io/get-pip.py

Sends Cloudwatch Event notifications to Slack

What is this?

AWS have released a new featue called CloudWatch Events, which lets you configure events fired by cloudwatch and direct them to SNS, Lambda functions, etc. Here's the blog post

Motivational image:

Here's the motivational image:

Slack image

@sanggiChoi
sanggiChoi / statistical_tests.py
Created August 13, 2018 09:43 — forked from mblondel/statistical_tests.py
t-test and wilcoxon-test examples in Python
# Mathieu Blondel, February 2012
# License: BSD 3 clause
# Port to Python of examples in chapter 5 of
# "Introductory Statistics with R" by Peter Dalgaard
import numpy as np
from scipy.stats import ttest_1samp, wilcoxon, ttest_ind, mannwhitneyu
# daily intake of energy in kJ for 11 women
@sanggiChoi
sanggiChoi / pyenv+direnv on OSX.md
Created October 1, 2018 00:31 — forked from alexhayes/ pyenv+direnv on OSX.md
Awesomely easy virtualenvs on OSX using pyenv and direnv

Awesomely easy virtualenvs on OSX using pyenv and direnv

Never forget to activate that virtualenv or set that environment variable ever again...

Install

  1. Install pyenv

     brew install pyenv
    
@sanggiChoi
sanggiChoi / install_jq.sh
Created October 29, 2018 05:21 — forked from kamermans/install_jq.sh
Install jq (JSON Command Line processor)
#!/bin/bash -e
# This scripts installs jq: http://stedolan.github.io/jq/
JQ=/usr/bin/jq
curl https://stedolan.github.io/jq/download/linux64/jq > $JQ && chmod +x $JQ
ls -la $JQ

HOWTO: Installing Vault On AWS Linux

This is quick howto for installing vault on AWS Linux, mostly to remind myself. At the end of this tutorial, you'll have a working vault server, using s3 for the backend, self signed certificates for tls, and supervisord to ensure that the vault server is always running, and starts on reboot.

Setting up S3

First things first, let's set up an s3 bucket to use as the storage backend for our s3 instance.

  1. From the AWS Mangement Console, go to the S3 console.

  2. Click on the Create Bucket button

@sanggiChoi
sanggiChoi / stress_test.py
Created January 14, 2019 09:49 — forked from mda590/stress_test.py
Python script useful for stress testing systems
"""
Produces load on all available CPU cores.
Requires system environment var STRESS_MINS to be set.
"""
from multiprocessing import Pool
from multiprocessing import cpu_count
import time
import os
@sanggiChoi
sanggiChoi / aws.md
Created July 31, 2020 08:35 — forked from colinvh/aws.md
AWS Region Names

Alternative naming schemes for AWS regions

Purpose

The intent is to define terse, standards-supported names for AWS regions.

Schemes