Skip to content

Instantly share code, notes, and snippets.

@bolorino
bolorino / gist:b3761b7890b05a6114baa6f334061c15
Created October 1, 2021 18:39
Get the crontab line for the Borg Backup job on each running LXC
#!/bin/bash
## Get the crontab line for the Borg Backup job on each running LXC
# Get the vm list
vms="$(lxc-ls -1 --running)"
for v in $vms
do
echo "$v"
lxc-attach -n "$v" -- /bin/bash -c "crontab -l | grep borg"
@bolorino
bolorino / borg-mount-personal-repo-zenity.sh
Created August 18, 2021 23:07
Borg backup repository mount for users
#!/bin/sh
# Mount/umount user's personal backup borg repository
# Zenity version
# @bolorino
CONFIG_REPO_FILE=~/.config/backups/repo-$USER.conf
if [ ! -f "$CONFIG_REPO_FILE" ]; then
zenity --error --width 300 --text "Config file missing."
exit 1
@bolorino
bolorino / ended.sh
Created August 18, 2021 22:20
Sends a notification through Pushover when a process finish
#!/bin/sh
# Send a notification through Pushover when a process finish.
# Usage: ended.sh pid 'message to send'
# @bolorino
# Pushover: https://pushover.net/
pid=$1
MESSAGE="$2"
TOKEN=your-pushover-app-token
USER=your-pushover-user-key
#!/bin/bash
# process-pdfs.sh
#
# por Jose Bolorino
# https://github.com/bolorino
#
################
# Procesa un directorio con archivos PDF para:
# 1.- Separar los archivos de varias páginas en varios archivos de 1 sola página
@bolorino
bolorino / xmlrpc.conf
Created September 28, 2014 17:47
WordPress fail2ban xmlrpc filter
# /etc/fail2ban/filter.d/xmlrpc.conf
[Definition]
failregex = ^<HOST> .*POST .*xmlrpc\.php.*
ignoreregex =
@bolorino
bolorino / wordpress-auth.conf
Created September 28, 2014 17:46
WordPress auth fail2ban filter
# /etc/fail2ban/filter.d/wordpress-auth.conf
[Definition]
failregex = <HOST>.*POST.*(wp-login\.php|xmlrpc\.php).* 403
@bolorino
bolorino / jail.local
Last active August 29, 2015 14:07
fail2ban WordPress jail
[wordpress]
enabled = true
port = http,https
filter = wordpress-auth
logpath = /var/log/nginx/access.log
maxretry = 3
bantime = 3600
[xmlrpc]
enabled = true
@bolorino
bolorino / iptables.firewall.rules
Created September 28, 2014 17:44
iptables config
*filter
# Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT -d 127.0.0.0/8 -j REJECT
# Accept all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all outbound traffic - you can modify this to only allow certain traffic
@bolorino
bolorino / security.php
Created September 28, 2014 17:42
WordPress Plugin: Enable 403 status on login failed
<?php
/**
* Plugin Name: Security Auth
* Plugin URI: http://kovshenin.com/2014/fail2ban-wordpress-nginx/
* Description: Enable 403 status on login failed.
* Tags: security, login
* Version: 1.0
* License: GPLv2
* Author: Konstantin Kovshenin
* Author URI: http://kovshenin.com/
@bolorino
bolorino / single-performance.php
Last active August 29, 2015 14:05
Get Performance Custom Data. Template: single-performance.php
<?php
/** Theatre WP
* Get Performance Custom Data
* within the loop
**/
$performance_custom = $theatre_wp->get_performance_custom( get_the_ID() );
/** Array returns
* $performance_custom['spectacle_id']