Skip to content

Instantly share code, notes, and snippets.

View svenikea's full-sized avatar
🏠
Working from home

John Wick svenikea

🏠
Working from home
View GitHub Profile
@svenikea
svenikea / README.md
Created December 26, 2022 13:57 — forked from reegnz/README.md
Using terraform for_each and toset instead of count

Using terraform for_each and toset instead of count

Using terraform count and the pain of working with it

If you're using terraform extensively you probably ran into an issue like this.

This is a synthetic example but I still hope the problem is recognizable as something that also happens out in the wild.

First, you have a list variable (in terraform.tfvars)

Setup multiple git identities & git user informations

/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉

Setup multiple git ssh identities for git

  • Generate your SSH keys as per your git provider documentation.
  • Add each public SSH keys to your git providers acounts.
  • In your ~/.ssh/config, set each ssh key for each repository as in this exemple:
@svenikea
svenikea / docker-clean.md
Created April 14, 2021 05:58 — forked from kuznero/docker-clean.md
Cleanup docker images and containers after failed builds

Cleanup docker images and containers after failed builds

Sometimes, there are some untagged images left behind after failed builds. In order to get rid of those, this script can be used.

#!/bin/bash
docker rm $(docker ps -aq)
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@svenikea
svenikea / daemon.json
Created March 12, 2021 06:31
Example Docker daemon.json
{
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"cgroup-parent": "",
"cluster-store": "",
"cluster-store-opts": {},
"cluster-advertise": "",
"debug": true,