Skip to content

Instantly share code, notes, and snippets.

View joariasl's full-sized avatar

Jorge Arias joariasl

View GitHub Profile
@joariasl
joariasl / load-envs-docker-entrypoint.sh
Last active March 28, 2024 02:10
Docker EntryPoint to load environment variables from files to use with file mounted secrets like Secret Store CSI Driver
#!/bin/sh
ENV_PATH_SEPARATOR=${ENV_PATH_SEPARATOR:-':'}
oldIFS=$IFS
IFS=$ENV_PATH_SEPARATOR
for ENV_FILE in $ENV_PATH; do
if [ -f "$ENV_FILE" ]; then
export $(grep -v '^#' "$ENV_FILE" | xargs -0)
else
@joariasl
joariasl / cross-compile_filebeat_arm.md
Last active March 27, 2023 14:05 — forked from wjx0912/cross-compile_filebeat_arm.md
Cross-compile Elastic Filebeat for ARM with docker. Works on Raspberry Pi 2 and 3.

Elastic does not provide Filebeat binaries for ARMv7. Luckily, Filebeat can easily be cross-compiled with:

# ----- Instantiate an immutable Go container for cross-compilation ----- #
mkdir build && cd $_
docker run -it --rm -v `pwd`:/build golang:latest /bin/bash

# ----- Inside Go container ----- #
go get github.com/elastic/beats
cd /go/src/github.com/elastic/beats/filebeat/
@joariasl
joariasl / aws-sts.sh
Last active November 3, 2021 15:06
Script to issue a STS token using an AWS profile credential that set another AWS profile credential with the result
#!/bin/bash
script_name=`basename "$0"`
text_bold=$(tput bold)
text_normal=$(tput sgr0)
showHelp() {
echo -e "${script_name}
${text_bold}DESCRIPTION${text_normal}
@joariasl
joariasl / github_gpg_key.md
Last active May 17, 2023 19:16 — forked from ankurk91/github_gpg_key.md
Github : Signing commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.

  • Install required tools

  • Latest Git Client

  • gpg tools

    # Ubuntu
    

sudo apt-get install gpa seahorse

Keybase proof

I hereby claim:

  • I am joariasl on github.
  • I am joariasl (https://keybase.io/joariasl) on keybase.
  • I have a public key ASB891JBm8_ZCjZ077JaZKlyqCJG6wD0M7f_I_1T5fp_1go

To claim this, I am signing this object:

@joariasl
joariasl / upgrade-kernel-centos-7.sh
Last active March 27, 2021 06:34
Upgrade kernel CentOS 7
#!/bin/bash
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
yum --enablerepo=elrepo-kernel install kernel-ml
#yum --enablerepo=elrepo-kernel install kernel-lt
# Set the new kernel as default
grub2-set-default 0
@joariasl
joariasl / 100_ddns.sh
Last active October 27, 2016 04:38
DDNS DonWeb NetworkManager /etc/NetworkManager/dispatcher.d/100_ddns.sh
#!/bin/sh
INTERFACE=$1 # The interface which is brought up or down
STATUS=$2 # The new state of the interface
case "$STATUS" in
'up') # $INTERFACE is up
if [[ "$INTERFACE" == "enp6s0" && $(hostname -i | grep "192.168.1.2" | cut -d " " -f 1) ]]; then
curl -basic -u "USERNAME:PASSWORD" -d "modulo=dnsDinamico&archivo=dnsDinamico&clienteDeActualizacion=api&op=actualizarHosts&hostNames[]=xxxxddn1.donweb-homeip.net" "https://administracion.donweb.com/ws/api.php"
fi
@joariasl
joariasl / bash_arguments.sh
Last active January 6, 2016 17:46
Bash command line arguments parse
#!/bin/bash
showUsage() {
echo "Usage:
Usage instruction..."
}
if (( ${#@} == 0 )); then
showUsage
exit 1
@joariasl
joariasl / upload_pdf.php
Last active November 17, 2015 16:13
Guardar archivo en PHP (ejemplo, no resuelto conflicto de nombre)
<?php
if($_FILES['file']['type'] === 'application/pdf'){// Siendo 'file' el name del parametro recibido
$uploaddir = './var/';// Especificar ruta de destino en folder
$time_file = time();
$file_name = date('YmdHis', $time_file).'.pdf';
$uploadfile = $uploaddir . $file_name;//Nombre del archivo sera fecha
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {// Si guarda correctamente hacer
/* TODO - Archivo guardado */
echo "Archivo $file_name guardado correctamente";
}