Skip to content

Instantly share code, notes, and snippets.

View backenv's full-sized avatar

BackEnv backenv

  • El Vilosell
View GitHub Profile
@backenv
backenv / vpn_deploy.sh
Created June 7, 2024 08:59
Create a VPN server from scratch
# Define static ip value from STATIC_IP environmental variable
#/bin/bash
IF [[ -z $STATIC_IP ]]; THEN
echo "STATIC_IP enviroment variable not found, please define it and rerun script"
ELSE
cat <<EOF > /etc/netplan/60-floating.yaml
network:
version: 2
renderer: networkd
ethernets:
@backenv
backenv / deployRpkg.sh
Last active March 27, 2024 19:00
BASH script to deploy R package. Execute with symlink from <$PATH>/deployRpkg
#!/usr/bin/env bash
set -e
showhelp() {
echo "[?] Usage: $0 --dir <PATH> [--data <PATH> --to-repo]"
echo "----------------------------------------------"
echo -e "[+]\t--dir: R package folder"
echo -e "[+]\t--data: Model data folder"
echo -e "[+]\t--to-repo: Publish to remote repository (curl -X PUT)"
echo -e "[+]\t--remove: Remove package before installation"
@backenv
backenv / forminator-datepicker-limit.php
Last active February 19, 2024 20:22
php mu-plugin to extend date selection forminator functionality
<?php
/* Constants definition, modify as needed
- TARGET_FORM: (int) form id to be validated
- MAX_ENTRIES_COUNT: (int) max value for the entries counted at database
- DATE_LABEL: (string) name of the input datepicker from the form
- NUMBERS_LABELS: (string[]) names of the numeric inputs from the form
*/
const TARGET_FORM = 1855;
const MAX_ENTRIES_COUNT = 39;
@backenv
backenv / base-install-cloud.yaml
Last active May 9, 2025 08:07
Hetzner cloud-config example with nginx and certboot
#cloud-config
packages:
- nginx
- certboot
- fail2ban
- ufw
package_update: true
package_upgrade: true
runcmd:
- printf "[sshd]\nenabled = true\nbanaction = iptables-multiport" > /etc/fail2ban/jail.local
@backenv
backenv / datatable_download.js
Created August 30, 2022 20:51
Download html table with javascript
// Javascript functions to allow html tables to be downloaded as CSV
// Thanks to CodexWorld for the functions code
// https://www.codexworld.com/export-html-table-data-to-csv-using-javascript/
function downloadCSV(csv, filename) {
var csvFile;
var downloadLink;
// CSV file
csvFile = new Blob([csv], {type: 'text/csv'});
@backenv
backenv / gitup.sh
Created March 3, 2022 19:31
Ease git push to repo, accepts extra parameter for commit message, "UP" if empty. Looks for .gitup files inside project directory tree, runs it from the directory where are found. Commits files from calling folder and down
#!/usr/bin/env bash
## find working path
commit_path=$(realpath .)
echo "GITUP commit at ${commit_path}"
if [[ -z $1 ]]; then
echo "Creating UP commit"
msg="UP"
else
@backenv
backenv / dell_vostro_3650.sh
Created January 29, 2022 12:02
Wifi adapter configuration
#!/bin/sh
# -- IMPORTANT LINKS --
# https://wiki.debian.org/wl
# https://wiki.debian.org/wl#supported
# https://wiki.debian.org/bcm43xx
# https://wiki.debian.org/WiFi/HowToUse
# https://askubuntu.com/questions/235279/my-wifi-adapter-is-not-working-at-all-how-to-troubleshoot
# https://www.linux.org/threads/no-wifi-adapter-found.22187/
# https://askubuntu.com/questions/55868/installing-broadcom-wireless-drivers/60395#60395
@backenv
backenv / rayshader_deploy.sh
Created October 25, 2021 15:32
Install requirements for rayshader R package on debian 11 machine
#!/bin/sh
## Visit official page at:
## https://github.com/tylermorganwall/rayshader
## https://www.tylermw.com/3d-ggplots-with-rayshader/
## system dependencies
aptitude -y install mesa-utils libglu1-mesa-dev \
freeglut3-dev mesa-common-dev libglew-dev libglfw3-dev libglm-dev \
libao-dev libmpg123-dev gir1.2-freetype2-2.0 libfreetype-dev \
@backenv
backenv / burgeon-unicodes.sh
Created June 4, 2021 18:24
Burgeon Unicodes.sh
#!/bin/sh
## Unicode values recovered from
# https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode
echo -e "\U1d505\U1d532\U1d52f\U1d524\U1d522\U1d52c\U1d52b"
@backenv
backenv / devtools_debian.sh
Created February 16, 2021 19:03
Install R package development tools on debian system
#!/bin/sh
set -e
apt update && apt install -y \
r-base \
r-cran-devtools \
r-cran-rmarkdown \
r-cran-rcpp \
texinfo \