Skip to content

Instantly share code, notes, and snippets.

View andrius's full-sized avatar

Andrius Kairiukstis andrius

View GitHub Profile
@andrius
andrius / elixir-in-docker.zsh
Last active March 26, 2018 19:36
Elixir in docker, without installation #docker #elixir
# cat ~/.zsh.after/elixir.zsh | pbcopy
elixir(){
docker run --tty --interactive --rm --user `id -u`:`id -g` \
--volume "$PWD":/tmp/elixir/app --workdir /tmp/elixir/app \
--name "elixir-`basename $PWD`" elixir:alpine "$@"
}
alias iex="elixir iex $@"
alias mix="elixir mix $@"
@andrius
andrius / Dockerfile
Last active January 2, 2023 13:39
multi-stage Elixir build (this create production-ready image, small as possible) #docker #elixir
#===========
#Build Stage
#===========
FROM elixir:alpine as build
#Copy the source folder into the Docker image
COPY elixir-docker-guide/ .
#Install dependencies and build Release
ENV MIX_ENV prod
@andrius
andrius / docker-volume-migration.md
Last active November 16, 2022 16:03
#howto rename #docker volume

Say, folder with docker-compose files was renamed or we do merging volumes etc. Then we shall rename docker volume. Because docker natively does not support renaming, we shall create it, then copy data, then inspect new volume, test and delete old one at the end

Volumes:

docker volume ls
# docker volume name databases_mysql
docker run -ti --rm \
-v databases_mysql:/volume \
-v ${PWD}:/backup alpine \
tar -cjf /backup/databases_mysql.tar.bz2 -C /volume ./
require 'pp'
def embedded_hash(levels, key, data)
if levels == 0
{key => data}
else
{key => embedded_hash(levels-1, key, data)}.merge(data)
end
end
@andrius
andrius / # crystal - 2019-08-10_13-44-09.txt
Created August 10, 2019 13:34
crystal on Debian GNU/Linux 9.9 (stretch) - Homebrew build logs
Homebrew build logs for crystal on Debian GNU/Linux 9.9 (stretch)
Build date: 2019-08-10 13:44:09
@andrius
andrius / # crystal - 2019-08-10_14-30-50.txt
Created August 10, 2019 14:49
crystal on Debian GNU/Linux 9.9 (stretch) - Homebrew build logs
Homebrew build logs for crystal on Debian GNU/Linux 9.9 (stretch)
Build date: 2019-08-10 14:30:50
@andrius
andrius / # crystal - 2019-08-10_14-47-32.txt
Created August 10, 2019 14:50
crystal on Debian GNU/Linux 10 (buster) - Homebrew build logs
Homebrew build logs for crystal on Debian GNU/Linux 10 (buster)
Build date: 2019-08-10 14:47:32
@andrius
andrius / description.md
Last active September 30, 2019 12:17
Loopback SIP calls with Asterisk PBX

Loopback SIP call with Asterisk

Reason

I need it for testing of new AMI/AGI/ARI library with crystal-lang;

Demo

asciicast

@andrius
andrius / terminate-calls-after-timeout.md
Last active October 27, 2019 20:11
Script to terminate Asterisk PBX calls after the timeout

Initial steps:

Following command will print out details of all active calls:

asterisk -rx "core show channels concise"
# Output:
# SIP/alice-00000002!asterisk.cr!!1!Up!Echo!!!!!3!77!!1572188916.4