Skip to content

Instantly share code, notes, and snippets.

View Belval's full-sized avatar
🐢
Slow to respond

Edouard Belval Belval

🐢
Slow to respond
  • Amazon Web Services
  • Canada
View GitHub Profile
@Belval
Belval / pytile.py
Last active July 24, 2019 14:35
Takes a directory of images, create pages with 6 images per page.
import os
import re
import sys
from subprocess import Popen
from PIL import Image
from pdf2image import convert_from_path
def pdfs_to_images(in_dir, out_dir):
for i, f in enumerate(os.listdir(in_dir)):
@Belval
Belval / backup_nextcloud_data.sh
Last active November 13, 2018 21:58
Script to backup Nextcloud install on Ubuntu
# We aim to be able to recover the whole Nextcloud install in case of failure,
# not just the files so we will backup the config too.
SAVE_FOLDER='/mnt/samba/nextcloud/'
NEXTCLOUD_FOLDER='/var/snap/nextcloud/common/nextcloud/'
ARCHIVE_TIMESTAMP=$(date +"%m_%d_%Y")
# Just in case
mkdir $SAVE_FOLDER
@Belval
Belval / install_goaccess.sh
Last active June 2, 2023 20:38
A script to setup goaccess on Ubuntu for nginx
# Install goaccess
echo "deb https://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list
wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install goaccess
# Update logrotate so it won't create tiny files
echo "
/var/log/nginx/*.log {
yearly
@Belval
Belval / setup_autossh_server.sh
Created May 16, 2018 19:32
A script to setup autossh (server side)
# Create user tunnel
sudo useradd -m tunnel
# Enter some easy password (we'll flush it afterwards)
sudo passwd tunnel
read -p "Run the client script on your client now. When you're done, press [ENTER]."
# Delete tunnel user password
sudo passwd -d tunnel
# Remove access to the shell for this user
@Belval
Belval / setup_autossh_client.sh
Last active April 5, 2021 11:34
A script to setup ssh tunnelling with autossh on a client
# First run setup_autossh_server.sh on your server THEN run this one
# Install autossh
sudo apt install autossh
# Create user tunnel
sudo useradd -m tunnel
sudo su tunnel
# Create key pair
ssh-keygen
# Copy it to the server
ssh-copy-id -i tunnel@[YOU IP/DOMAIN HERE]
@Belval
Belval / install_gitea.sh
Last active November 16, 2021 23:03
A script to install gitea and run it as a service on Ubuntu
#!/bin/sh
mkdir gitea
cd gitea/
# Replace this with whatever version is relevant now.
wget https://dl.gitea.io/gitea/1.4.1/gitea-1.4.1-linux-amd64
# Same here
mv gitea-1.4.1-linux-amd64 gitea