Skip to content

Instantly share code, notes, and snippets.

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

LoreLLo lorello

🏠
Working from home
View GitHub Profile
@lorello
lorello / elastic.yml
Created August 22, 2023 14:48
Logging su ElasticSearch da docker swarm
version: '3.8'
services:
elastic-firenze:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.4
networks:
- internal
environment:
- node.name=es01
@lorello
lorello / setup-proxy.sh
Created June 21, 2023 10:13
Setup Proxy per Docker Daemon
#!/usr/bin/env bash
[[ -n $DEBUG ]] && set -x
if [[ $UID -gt 0 ]]; then
echo "Script must run as root"
exit 1
fi
proxy_address=${PROXY_SERVER:-http://127.0.0.1:3128}
@lorello
lorello / main.go
Last active May 11, 2023 16:59
Exec a command in golang and pass an input to a command using stdin
package main
import (
"log"
"os/exec"
"strings"
)
func main() {
@lorello
lorello / byobu-unattended-setup.sh
Last active February 26, 2023 16:34
Byobu unattended setup
if ! which byobu >/dev/null; then
echo "Byobu not installed, skip configuration"
exit 1
fi
[[ ! -f /var/lock/.byobu-shell-fixed ]] && \
echo "fixes byobu problem with UMASK, now byobu-shell is a login shell" && \
sed -i -e 's/exec "$SHELL"/exec "$SHELL" --login/' /usr/bin/byobu-shell && \
touch /var/lock/.byobu-shell-fixed
@lorello
lorello / gh-download-latest.sh
Created February 9, 2023 23:49
Download latest github version os something
wget $(curl -s https://api.github.com/repos/$USER/$REPO/releases/latest | jq -r '.assets[] | select(.name|match("Linux_x86_64.tar.gz$")) | .browser_download_url') && tar xzvf *.tar.gz kaf
@lorello
lorello / README.md
Created December 17, 2021 18:02
Opencontent Developer Links
@lorello
lorello / gist:69e16f1c9caa851f1fcbb674d545a109
Last active March 8, 2021 23:58
Unattended upgrades configuration
#!/usr/bin/env bash
set -e
[[ $DEBUG ]] && set -x
conf=/etc/apt/apt.conf.d/50unattended-upgrades
if [[ ! -f $conf ]]; then
echo "Cannot fine /etc/apt/apt.conf.d/50unattended-upgrades, is this an Ubuntu host?"
exit 1
@lorello
lorello / deploy.sh
Last active March 30, 2021 13:07
Swarm deploy utility with slack notification
#!/bin/bash
# vim: autoindent tabstop=2 shiftwidth=2 expandtab softtabstop=2 fileencoding=utf-8
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
DEPLOY_CONTEXT=
@lorello
lorello / gist:9c0bb25194d403c53963b4cb15ccbbaa
Created September 8, 2020 21:36
Realtime accesslog statistic of Traefik web router with goaccess
docker logs -f traefik | \
goaccess \
--log-format "%h %^ %e [%d:%t %^] \"%r\" %s %b \"%R\" \"%u\" %^ \"%v\" \"%^\" %Lms" \
--date-format "%d/%b/%Y" --time-format "%H:%M:%S"
@lorello
lorello / docker-setup-loki-plugin.sh
Last active August 27, 2020 00:25
Loki plugin for docker setup
#!/bin/bash
set -ex
if docker plugin inspect loki > /dev/null; then
echo "Loki plugin already installed"
else
docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
fi