Skip to content

Instantly share code, notes, and snippets.

Avatar

carles san agustin carlessanagustin

View GitHub Profile
@carlessanagustin
carlessanagustin / functions.tf
Created Jan 20, 2021
Terraform functions by example
View functions.tf
##--------------------------
## Terraform: Functions ##
##--------------------------
## Open terraform console
terraform console
#######################
## Numeric Functions ##
#######################
@carlessanagustin
carlessanagustin / win2ix.md
Last active Feb 24, 2022
Windows and Unix command line equivalents
View win2ix.md
Windows command Unix command Notes
set env Set on Windows prints a list of all environment variables. For individual environment variables, set is the same as echo $ on Unix.
set Path export $PATH Print the value of the environment variable using set in Windows.
set PROJ -- result: PROJ=c:\project
echo %PROJ% echo $PROJ result: c:\project

|

View announce.sh
#!/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 / ssl_keys.bash
Last active Jan 11, 2022
SSL files & folders permissions
View ssl_keys.bash
#!/usr/bin/env bash
sudo su -
mkdir /etc/ssl
mkdir /etc/ssl/certs
mkdir /etc/ssl/private
chmod 755 /etc/ssl
chmod 755 /etc/ssl/certs
@carlessanagustin
carlessanagustin / find-file-in-files.md
Created Feb 25, 2016
Finding all files containing a text string on Linux
View find-file-in-files.md

Finding all files containing a text string on Linux

Do the following:

grep -rnw '/path/to/somewhere/' -e "pattern"

-r or -R is recursive, -n is line number and -w stands match the whole word. -l (lower-case L) can be added to just give the file name of matching files.

@carlessanagustin
carlessanagustin / ssh_reverse_tunnel.sh
Last active Dec 10, 2021
SSH reverse tunnel as systemd service
View ssh_reverse_tunnel.sh
#!/usr/bin/env bash
: '
SOURCE node creates a tunnel to DESTINATION
This allows connections from DESTINATION to SOURCE with: ssh $USERNAME@localhost -p 19999
'
USERNAME=tunnel
PRIVKEY=/etc/tunnel/id_rsa
DESTINATION=ssh.example.com
@carlessanagustin
carlessanagustin / home.ssh_config
Created Jun 4, 2018
SSH disable strict host Key checking - $HOME/.ssh/config
View home.ssh_config
Host *
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
@carlessanagustin
carlessanagustin / purge2.sh
Last active Nov 21, 2021
Script to reduce VM size before packaging for Vagrant v.2
View purge2.sh
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
# - https://gist.github.com/adrienbrault/3775253
## for vagrant related tasks, uncomment vagrant comments
# vagrant: Unmount project
View 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 Sep 9, 2021
Makefile example lines
View Makefile
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