Skip to content

Instantly share code, notes, and snippets.

let requestData = {
  "email": "",
  "name": "",
  "userID": ""
}

function validateRequest(reqData) {
  return new Promise((resolve, reject) => {
    if (reqData.email == "") {
Description: (SO0062) - Distributed Load Testing on AWS is a reference architecture to perform application load testing at scale. Version v2.0.1
AWSTemplateFormatVersion: "2010-09-09"
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Console access
Parameters:
- AdminName
- AdminEmail
Description: (SO0062) - Distributed Load Testing on AWS is a reference architecture to perform application load testing at scale. Version v2.0.1
AWSTemplateFormatVersion: "2010-09-09"
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Console access
Parameters:
- AdminName
- AdminEmail
@rubikill
rubikill / export_log.sh
Last active November 7, 2023 16:03
Build psql report RDS using pgbadger
# sh export_log.sh db_identifier
# If any of this commands fail, stop script.
set -e
db_identifier=$1
date=$(date -v-7H +'%Y-%m-%d-%H')
log_file=~/Desktop/postgresql.log.$date
report_file=~/Desktop/out.$date.html
page_size=100000
@rubikill
rubikill / docker_postgres.sh
Created June 29, 2020 17:02 — forked from ledongthuc/docker_postgres.sh
Docker postgres actions
# Docker postgres backup data
docker exec -t -e PGPASSWORD={password} {container_name} pg_dump -U {username} --column-inserts --data-only --schema={schema} {database_name} > /path/to/exported/file.sql
# Docker postgres run script from outside
docker cp /host_path.sql captrondb:/container_inside.sql
docker exec -u {login_user} {container_name} psql {database_name} {db_username} -f /container_inside.sql # with continer username
docker exec {container_name} psql {database_name} {db_username} -f /container_inside.sql # without continer username
defmodule App do
@x "123"
@y "456"
@z "789"
def fx1 do
for _ <- 1..100_000 do
"#{@x}#{@y}#{@z}"
end
end

OTP Applications là gì?

1. OTP là gì?

Chắc bạn đang nghĩ tới One time Password. Nhưng không phải, OTP là cụm từ viết tắt của Open Telecom Platform. Đây có thể xem như là 1 framework dùng để thiết kế ứng dụng mà cấu thành bới những phần nhỏ của ứng dụng có thể chạy trên 1 process riêng. Nó bao gồm:

  • an Erlang interpreter (which is called BEAM)
  • an Erlang compiler
  • a protocol for communication between servers (nodes)
  • a CORBA Object Request Broker
  • a static analysis tool called Dialyzer
  • a distributed database server (Mnesia)

Mục đích bài viết này để

  1. Giới thiệu về phương pháp lập trình bất đồng bộ với cách tiếp cận khác những ngôn ngữ như Java hoặc C#.
  2. Những bước đầu tiên để viết 1 chương trình chạy bất đồng bộ bằng Elixir
  3. Hi vọng sẽ lôi kéo được thêm người học Elixir :)

1. Concurrent Programming

Concurrent Programming hiểu đơn giản là việc lập trình cho phần mềm có thể chia nhỏ tác vụ và chạy đồng thời, độc lập với nhau. Elixir là ngôn ngữ lập trình được

@rubikill
rubikill / cron.go
Created August 9, 2017 10:43 — forked from stupidbodo/cron.go
Golang - Keep more than 1 program running forever (similar to cron job but shorter interval)
package main
import (
"fmt"
"runtime"
"time"
)
var (
INTERVAL_SEC = 10
@rubikill
rubikill / bash-cheatsheet.sh
Created May 24, 2017 09:47 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04