Skip to content

Instantly share code, notes, and snippets.

View andrius's full-sized avatar

Andrius Kairiukstis andrius

View GitHub Profile
@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
@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 / 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 / installDante.sh
Created February 28, 2018 11:57 — forked from Fire-/installDante.sh
Basic Dante Socks5 Server Setup and Configuration
# Basic Dante Socks5 Setup, Debian
apt-get update
apt-get install make gcc
cd /usr/src
# get newest from http://www.inet.no/dante/download.html
wget http://www.inet.no/dante/files/dante-1.4.1.tar.gz
@andrius
andrius / mac_ip.sh
Last active March 26, 2018 19:37
IP address of docker host (mac) in shell scripts. Only works with #docker for #macos
#!/bin/sh
# Tested on alpine linux
# Thanks to `docker.for.mac.localhost` (or `docker.for.mac.host.internal`)
# featured in https://docs.docker.com/docker-for-mac/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host,
# it's possible to access host (mac) services
# mac_ip will set IP address (MAC_IP) of mac visible from docker container and
# return code (0 = IP found, 1 = not found)
mac_ip() {
# terminate block.call after given timeout
# https://github.com/crystal-lang/crystal/issues/2990
module Timeout
def self.timeout(terminate_after : Float64, &block)
ch = Channel(Bool).new
spawn do
sleep terminate_after
ch.close
end

Keybase proof

I hereby claim:

  • I am andrius on github.
  • I am andrius_mobi (https://keybase.io/andrius_mobi) on keybase.
  • I have a public key whose fingerprint is 531E BDD4 2E17 31A4 27C4 BED9 FA85 A2DD 963A 379F

To claim this, I am signing this object:

@andrius
andrius / Procfile
Last active July 22, 2022 22:00
How to dockerize #rails app with #puma. Edit config/application.rb and config/puma.rb #docker #ruby
api: bundle exec puma -C config/puma.rb
@andrius
andrius / osx-for-hackers.sh
Last active July 21, 2022 22:44 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox... #macos #setup #dotfiles
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@andrius
andrius / fix-permissions.sh
Created September 30, 2015 12:15
Fixes file permissions in Dropbox folder (windows make them wrong)
#!/bin/sh
cd ~/Dropbox
# Remove conflicted copies
find . -iname '*conflicted copy*' | \
awk -F '-8-8-8-8-8-' '{print "\""$1"\""}' | xargs rm -rf
find . -type f \
-perm 755 \