Skip to content

Instantly share code, notes, and snippets.

% Run in Erlang Shell
% See initial call, ancestors in process_info
ShellPid = self().
PFun = fun() -> Pid = self(), ShellPid ! [Pid,erlang:process_info(Pid)] end.
proc_lib:spawn(PFun).
@koolquark
koolquark / check_id.py
Created June 10, 2018 02:23
Validate Email ID using validate_email
# Check Email ID Validity
from validate_email import validate_email
import sys
basename = sys.argv[1]
available = []
for email_id in [ basename + '@gmail.com' , basename + '.web@gmail.com']:
# print("Verifying Email ID : " + email_id)
if len(email_id) > 15:
@koolquark
koolquark / custom_bridge.sh
Last active June 19, 2018 18:07
Docker Custom Bridge
# List netwoks
docker network ls
# Prune un-necessary networks
docker network prune
# Create a custom bridge network
# See man docker-network-create
docker network create \
--driver=bridge\
@koolquark
koolquark / docker_erl_observer.md
Last active June 20, 2018 03:27
Docker Image With Erlang and Observer

Docker Image

Docker Image with Erlang and Observer.

Dockerfile

FROM debian:9
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update                                                            && \
    apt-get install -y --no-install-recommends curl make wget                 && \
                                                                                 \
 wget --no-check-certificate https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && \
@koolquark
koolquark / docker_bind_mount.md
Created June 20, 2018 06:09
Bind Mounting in Docker : Example 1

Bind Mounting

docker run -itd  --name devtest --mount type=bind,source=/tmp/bm1,target=/app  alpine:latest
@koolquark
koolquark / docker_notes.md
Last active August 25, 2018 13:29
Docker Notes and Examples

Concepts

  • Levels of abstraction

    • App In Container (Dockerfile)
    • Services ( docker compose yml )
      • Ports
      • How many replicas of container ?
      • Scaling ?
    • Stack ( Service Interactions ) ( Top Layer )
  • Docker

@koolquark
koolquark / pynow.py
Created July 7, 2018 07:47
Python time - now in strftime
from datetime import datetime
now = datetime.now()
print(now.strftime("%Y-%m-%d-%M__%H-%M-%S"))
# >>> from datetime import datetime
# >>> now = datetime.now()
# >>> print(now.strftime("%Y-%m-%d-%M__%H-%M-%S"))
# 2018-07-07-47__07-47-00
# >>>
@koolquark
koolquark / docker_install.sh
Last active August 1, 2018 04:26
Install docker on Ubuntu 16.04
#!/bin/bash
# This is not an automated script
# Listing is only for line by line pasting
# Remove any existing installation
## sudo apt-get remove docker docker-engine docker.io
# For Kernel version > 4 overlay2 storage driver is preferred over aufs
# overlayfs already available in kernel version 4
# See uname -a
*.crashdump
_build/*
rebar.lock

YAML Notes ( 1.2 )

Links and resources

Overview

  • Human readable
  • Machine processable
  • Minimum structural elements

Basic Primitives

  • Scalars (Strings/Numbers)
  • Sequences (Arrays/Lists)