Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View carlessanagustin's full-sized avatar

carles san agustin carlessanagustin

View GitHub Profile
@carlessanagustin
carlessanagustin / announce.sh
Created February 23, 2022 11:00
logging and colors
#!/usr/bin/env bash
RED=$'\e[0;31m'
R=${RED}
BLUE=$'\e[0;34m'
B=${BLUE}
GREEN=$'\e[0;32m'
G=${GREEN}
CYAN=$'\e[0;36m'
C=${CYAN}
@carlessanagustin
carlessanagustin / k8s.initContainers.yaml
Created November 10, 2021 13:57
k8s.initContainers.yaml
### START: initContainers
initContainers:
- name: init-steps
command: ["sleep", "14400"]
image: alpine:latest
imagePullPolicy: IfNotPresent
resources:
limits:
memory: "128Mi"
cpu: "500m"
@carlessanagustin
carlessanagustin / Makefile
Created September 9, 2021 07:11
Makefile example lines
truststore_pass ?= password
java_path ?= /usr/bin/java
NODEINFO = $(shell basename additional-node-infos/*)
etc_hosts:
sed -i 's/.*127.0.0.1.*/127.0.0.1 localhost idman-host netmap-host notary-node/' /etc/hosts
@carlessanagustin
carlessanagustin / nested_loop.tf.md
Last active March 13, 2024 12:26
Terraform nested loop
  • In <filename>.tf:
variable "users" {
  default = [
    {
      name       = "user1"
      databases  =  ["db1","db2"]
      password   = "change_me"
      privileges = ["CONNECT","CREATE","TEMPORARY"]
@carlessanagustin
carlessanagustin / tmux.sh
Created April 13, 2021 09:14
Autostart tmux session when logging in via SSH
cat << 'EOF' > ~/.bash_profile
if [ -z "$TMUX" ]; then
tmux attach -t default || tmux new -s default
fi
EOF
@carlessanagustin
carlessanagustin / bash-colors.md
Last active March 18, 2021 11:18 — forked from Prakasaka/bash-colors.md
The entire table of ANSI color codes.

TLTR;

RED=$'\e[0;31m'
R=${RED}
BLUE=$'\e[0;34m'
B=${BLUE}
GREEN=$'\e[0;32m'
G=${GREEN}
CYAN=$'\e[0;36m'
@carlessanagustin
carlessanagustin / keycloak.sh
Created February 14, 2021 20:01 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@carlessanagustin
carlessanagustin / docker-compose.yml
Created January 26, 2021 11:25
Simple Nginx via Docker Compose file
version: '3'
services:
webserver:
image: nginx:latest
command: [nginx-debug, '-g', 'daemon off;']
ports:
- "8080:80/tcp"
@carlessanagustin
carlessanagustin / functions.tf
Created January 20, 2021 16:34
Terraform functions by example
##--------------------------
## Terraform: Functions ##
##--------------------------
## Open terraform console
terraform console
#######################
## Numeric Functions ##
#######################
@carlessanagustin
carlessanagustin / detect_os.sh
Created January 14, 2021 07:53
detect linux OS from packagecloud.io
: '
thanks to https://packagecloud.io/
You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version
'
detect_os_deb ()
{
if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then
# some systems dont have lsb-release yet have the lsb_release binary and
# vice-versa