Skip to content

Instantly share code, notes, and snippets.

View sgyyz's full-sized avatar
🎯
Focusing

Yongzhi Yang sgyyz

🎯
Focusing
View GitHub Profile
defmodule Release.Tasks do
@start_apps [
:postgrex,
:ecto,
:ecto_sql
]
@app_mods [
DockerizeElixir
]
#!/usr/bin/env bash
echo "Running database creation"
bin/dockerize_elixir command Elixir.Release.Tasks create_db
echo "DB created successfully"
#!/usr/bin/env bash
### Comment below block if it's a command ###
set +e
while true; do
nodetool ping
EXIT_CODE=$?
if [[ ${EXIT_CODE} -eq 0 ]]; then
echo "Application is up!"
## ....
environment :prod do
set include_erts: true
set include_src: false
set cookie: :"8[^a{lsZs|em/)Xg^pI}m2hXlmbzuuioM|[6mB6Pbno9MFuzWCNN{9TvK}(%]D<S"
set vm_args: "rel/vm.args"
set pre_start_hooks: "rel/hooks/pre_start"
set post_start_hooks: "rel/hooks/post_start"
end
@sgyyz
sgyyz / base_calculator.ex
Last active May 7, 2019 03:43
Elixir Abstract and Extends
defmodule BaseCalculator do
@moduledoc """
Define the base calculator and provide public API.
Define the callback to implement specific logic in child module.
"""
# it should be implemented by child module
@callback do_calculate(num1 :: Integer.t(), num2 :: Integer.t()) :: {:ok, Integer.t()} | {:error, any()}
defmacro __using__(_opts) do
@sgyyz
sgyyz / docker-compose.yml
Created January 20, 2020 01:17
OpenLdap & Phpldapadmin docker-compose.yml
version: '3'
services:
openldap:
image: osixia/openldap:1.3.0
ports:
- '389:389'
- '636:636'
phpldapadmin:
version: '3'
services:
mysql:
image: mysql:5.7
ports:
- "3306:3306"
command: "mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci"
volumes:
- mysql-dataset:/var/lib/mysql
@sgyyz
sgyyz / docker-compose.yml
Last active July 4, 2022 04:13
Postgres & PgAdmin docker-compose.yml
version: '3'
services:
postgres:
image: postgres
ports:
- "5432:5432"
volumes:
- pg-dataset:/var/lib/postgresql/data
environment:
@sgyyz
sgyyz / uao.sh
Created March 15, 2019 07:50
uao.sh
#!/bin/sh
fullFileName=$1
suffix=${fullFileName#*.}
if [ "$suffix" != "zip" ];then
echo "Must be a valid zip file"
else
filename=${fullFileName%.*}
@sgyyz
sgyyz / uao.md
Last active May 3, 2024 14:15
uao command - unzip your project and import to intellij automatically
  1. import project into idea command
$ curl -L "https://gist.githubusercontent.com/chrisdarroch/7018927/raw/9a6d663fd7a52aa76a943fe8a9bc6091ad06b18d/idea" -o /usr/local/bin/idea
$ chmod +x /usr/local/bin/idea
  1. unzip and open project command
$ curl -L "https://gist.githubusercontent.com/sgyyz/adfa4f05af3d81cf0e17e19cf7044c85/raw/b6b9e871d5a4f5435a09d00b0a52e3db0b90699a/uao.sh" -o /usr/local/bin/uao.sh
$ chmod +x /usr/local/bin/uao.sh
$ ln -sf /usr/local/bin/uao.sh /usr/local/bin/uao