Skip to content

Instantly share code, notes, and snippets.

View AntouanK's full-sized avatar

Antonios Karamitros AntouanK

View GitHub Profile
@AntouanK
AntouanK / docker-registry-start.sh
Last active April 15, 2019 20:14
docker registry script
#!/bin/bash
# # create auth first
#
# mkdir auth
# docker run \
# --entrypoint htpasswd \
# registry:2 -Bbn testuser testpassword > auth/htpasswd
@AntouanK
AntouanK / .extra-bashrc
Created January 19, 2018 07:58
extra bashrc
###################
# aliases
alias ls='ls --color -lahG'
# grep with color
alias grep='grep --color=auto'
# my ip
alias realip='curl curlmyip.com'
# git
alias gdevpull='git checkout develop && git pull'
alias gdelorphans='git branch -vv | grep '"': gone]'"' | awk '"'"'{print $1}'"'"' | xargs -n 1 git branch -d'
@AntouanK
AntouanK / get-parent-dir-path.sh
Created January 17, 2018 14:27
get directory path in bash script
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo $DIR
@AntouanK
AntouanK / letsencrypt.sh
Created December 16, 2017 11:31
letsencrypt docket certbot
sudo docker run \
-it \
--rm \
-p 443:443 \
-p 80:80 \
--name certbot \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
certbot/certbot certonly --rsa-key-size 4096
@AntouanK
AntouanK / ig.positions.js
Last active July 23, 2018 13:59
ig positions
(function(){
let names =
Array.prototype
.map.call($('.ig-positions [data-automation="instrumentName"]'), x => x)
.map(x => x.textContent.replace(/\sExpand/,'').trim());
let sizes =
Array.prototype
.map.call($('.ig-positions [data-automation="dealSize"]'), x => x)
-- file Spec.hs
{-# LANGUAGE OverloadedStrings #-}
import Control.Concurrent (threadDelay)
import Control.Exception (evaluate)
import qualified Data.ByteString.UTF8 as UTF8
import Data.List as List
import Database.Redis (ConnectInfo, Connection,
PortID (PortNumber), checkedConnect,
connectHost, connectPort,
Perf name Time
multicore.perf 9.234 seconds
onecore.perf 6.385 seconds
-A16M_-qb0.multicore.perf 7.451 seconds
-A16M_-qb0.onecore.perf 6.033 seconds
-A16M_-qg.multicore.perf 7.431 seconds
-A16M_-qg.onecore.perf 6.151 seconds
-A32M_-qb0.multicore.perf 7.169 seconds
-A32M_-qb0.onecore.perf 6.106 seconds

For reference, my CPU:

$ lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              16
On-line CPU(s) list: 0-15
Thread(s) per core:  2
Core(s) per socket:  8
@AntouanK
AntouanK / example.md
Last active June 15, 2017 12:48
Drone CI services container example

Say we have three containers.

  • A: a back-end API
  • B: an nginx "router"
  • C: a Chrome browser

when I launch the services, I want A to launch first, B afterwards, because it routes requests to A, and then C at the end, so it can make requests to B.

So right now, everytime I run the CI I get random results. Some time, B complains that A is not there. Meaning that the host name A doesn't resolve to anything. So it's not able to route any request.

docker run -it --rm -p 443:443 -p 80:80 --name certbot \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
quay.io/letsencrypt/letsencrypt:latest renew --rsa-key-size 4096