Skip to content

Instantly share code, notes, and snippets.

View charlyie's full-sized avatar

Charles Bourgeaux charlyie

View GitHub Profile
@charlyie
charlyie / Install whatever node.js version on raspberry pi, inclusing armv6l
Created July 29, 2023 11:25
Usage of unofficial builds of node.js to install node.js on Raspberry pi (armv6l)
#Download from https://unofficial-builds.nodejs.org/download/release/ the appropriate build for armv6l, example https://unofficial-builds.nodejs.org/download/release/v18.9.1/node-v18.9.1-linux-armv6l.tar.gz
wget https://unofficial-builds.nodejs.org/download/release/v18.9.1/node-v18.9.1-linux-armv6l.tar.gz
tar -xzf node-v18.9.1-linux-armv6l.tar.gz
cd node-v18.9.1-linux-armv6l
sudo cp -R * /usr/local
node -v
# If Debian 11 is ran on a LXC container (Proxmox), SSH login and sudo actions can be slow
# Check if in /var/log/auth.log the following messages
Failed to activate service 'org.freedesktop.login1': timed out (service_start_timeout=25000ms)
-> Run systemctl mask systemd-logind
-> Run pam-auth-update (and deselect Register user sessions in the systemd control group hierarchy)
@charlyie
charlyie / copydb.sh
Last active February 23, 2021 14:10
Will copy a database to another local one
#!/bin/bash
# copydb.sh
# description : will sync databases after backup
APP_VERSION="1.2.0-20210223"
### Editable variables
MYSQL_HOST="127.0.0.1"
MYSQL_USER="automysqlbackup"
MYSQL_PASS="xxxxxxx"
MYSQL_PORT="3306"
@charlyie
charlyie / Renew Let's encrypt certificate behind HAPROXY
Created September 30, 2020 07:20
HaProxy Certbot's Let's encrypt SSL HTTPS certificate renewal
# Authorize 8888 on Loadbalancer (haproxy)
# In the frontend:80 & frontend:443, add :
acl letsencrypt-acl path_beg /.well-known/acme-challenge/
use_backend letsencrypt-backend if letsencrypt-acl
# Add a new backend :
backend letsencrypt-backend
server letsencrypt 127.0.0.1:8888
# Run it once, for the 1st certificate generation
@charlyie
charlyie / Get Scaleway Private and Public IP in a file.sh
Last active August 12, 2020 07:21
Will use Scaleway API to fetch public and private IP linked to an account, and paste them in a file. Can trigger when IP are updated, and relaunch a firewall
#!/bin/bash
### description : fetch local network IP through Scaleway API (local IP changes on each reboot), and expose these IP in a file (e.g : for firewall purposed)
### Author : Charles Bourgeaux <charles@maecia.com>
### Date : 11 AUG 2020
### requires `jq` package
### Editable variables
SCALEWAY_TOKEN='xxxx-xxx-xxx-xxx-xxx'
SCALEWAY_ZONE='fr-par-1'
IP_LIST_FILE='/opt/sbin/local_authorized_ip'