Skip to content

Instantly share code, notes, and snippets.

atrakic /
Created May 28, 2021 — forked from wojteklu/
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

atrakic / post-receive
Created Jun 17, 2020 — forked from lemiorhan/post-receive
Post-receive hook to deploy the code being pushed to production branch to a specific folder
View post-receive
while read oldrev newrev refname
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
View resume.json
"meta": { "theme": "spartan" },
"basics": {
"name": "Admir Trakic",
"label": "Software engineer",
"email": "",
"phone": "(45) 29133654",
"website": "",
"summary": "Software engineer with hands-on experience in building and running open source in the cloud.",
"location": {

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server:

if [ "$#" -ne 1 ]; then
echo "Usage: $0 password"
echo "Specify your host's LAN IP and the desired Pihole password"
exit 1
if [ "$#" -ne 1 ]; then
echo "Usage: $0 password"
echo "Specify your host's LAN IP and the desired Pihole password"
exit 1
atrakic / gitlab-ci.yaml
Created Oct 16, 2019 — forked from lucj/gitlab-ci.yaml
kube deployment
View gitlab-ci.yaml
stage: deploy
environment: test
image: dtzar/helm-kubectl:2.12.3
- kubectl config set-cluster sophia-cluster --server=${KUBE_URL} --certificate-authority="${KUBE_CA_PEM_FILE}"
- kubectl config set-credentials sophia-admin --token=${KUBE_TOKEN}
- kubectl config set-context sophia-context --cluster=sophia-cluster --user=sophia-admin --namespace ${KUBE_NAMESPACE}
- kubectl config use-context sophia-context
- helm upgrade --reuse-values --set image.tag=$CI_BUILD_REF sophia k8s-chart
atrakic / urlencode
Created Oct 14, 2019 — forked from cbron/urlencode
URL encode/decode script
View urlencode
import urllib
import sys
text = sys.argv[1]
encoded = urllib.quote_plus(text)
print encoded
atrakic /
Created Oct 14, 2019 — forked from daxmc99/
#set -x
#set -e
k3d delete --name='rio'
k3d create -n rio --image rancher/k3s:v0.8.1 --publish 80:80 --publish 443:443 --publish 9443:9443 --publish 9080:9080 &&
declare -i i; i=0
until k3d get-kubeconfig --name='rio'
if (( i > 20 )); then
View gist:5a3a5bc974c98ab1b71dd69eee0e5856
name: hashicorp/terraform:light
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
- rm -rf .terraform
- terraform --version
- mkdir -p ./creds