Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Mona Lisa spagu

💭
I may be slow to respond.
View GitHub Profile
@spagu
spagu / log2hrs.py
Created Nov 8, 2020
List vsftpd log entries that are 2 days old only (slow version)
View log2hrs.py
#!/usr/bin/env python
import re
import datetime
format = '%b %d %H:%M:%S %Y'
filepath = '/var/log/vsftpd.log'
now = datetime.datetime.now()
now24 = now + datetime.timedelta(-2)
def parse_date_from_log_line(line):
@spagu
spagu / artowoo.sh
Created Mar 13, 2020 — forked from protorob/artowoo.sh
Bash Sript to Automate the Configuration of the Artomultiplo's Woocommerce Starter Kit
View artowoo.sh
#!/bin/bash -e
# Start allways the same
wpuser='yourusername'
wpuseremail='yourname@yourdomain.tld'
wpuserpass=$(date +%s | sha256sum | base64 | head -c 16)
dpprefix=$(date +%s | sha256sum | base64 | head -c 6)
clear
@spagu
spagu / docker-compose.yml
Created Nov 29, 2019
Wordpress docker-compose
View docker-compose.yml
version: '3.3'
services:
nginx:
image: nginx:latest
ports:
- '80:80'
volumes:
- ./nginx:/etc/nginx/conf.d
- ./logs/nginx:/var/log/nginx
@spagu
spagu / block-spam-ip-dnsmasq.sh
Created Oct 1, 2019
Get and block IP address for DNSMASQ and PFCTL
View block-spam-ip-dnsmasq.sh
#!/bin/sh
if [ ! -f /etc/hosts.blocked.org ]; then
cp /etc/hosts.blocked /etc/hosts.blocked.org
echo "no"
fi
TMP="/var/tmp/"
echo "" > ${TMP}output.txt
@spagu
spagu / setup-kubernetes-centos-7.md
Last active Oct 26, 2019
Install a Master Kubernetes Cluster on Centos 7
View setup-kubernetes-centos-7.md

Install a Master Kubernetes Cluster on Centos 7

Hardware Requirements MASTER/NODE

egrep --color 'vmx|svm' /proc/cpuinfo

Must have VMX or SVM processor flag that enables virtualisation.

@spagu
spagu / any2webp.sh
Created Mar 30, 2019
Converts any image to webp
View any2webp.sh
#!/usr/local/bin/bash
# 1. Install ImageMagic
# 2.Add “image/webp webp” to the file mime.types ( it should be there already )
#
# 3.Add to your main Nginx configuration.
# map $http_accept $webp_suffix {
# default "";
# "~*webp" ".webp";
# }
@spagu
spagu / expiry_sslcheck.sh
Created Sep 4, 2018
expiry_sslcheck.sh is a tool for monitoring SSL domains to avoid expiration date.
View expiry_sslcheck.sh
#!/usr/local/bin/bash
# All Rights reseverd to tradik.com
readonly VERSION=1.4.12
UNAME='/usr/bin/uname'
# Config you can make in here:
DATABASE="$1.db"
SQLITE='/usr/local/bin/sqlite3'
@spagu
spagu / pre-commit
Last active Nov 19, 2020
subversion pre-commit hook for PHP lint, PSR-2 and CSS validation + comments
View pre-commit
#!/bin/sh
# SVN PRE-COMMIT HOOK
#
# Requirements:
# - PHP installed ( https://secure.php.net/manual/en/install.php )
# - PHPCS installed ( https://github.com/squizlabs/PHP_CodeSniffer + https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards )
# - csslint installed ( https://github.com/CSSLint/csslint/wiki/command-line-interface )
# - i18n0lint installed ( https://github.com/jwarby/i18n-lint )
@spagu
spagu / docx-to-html.sh
Created Feb 24, 2018
Script to convert DOCX to HTML using bash and pandoc
View docx-to-html.sh
#!/usr/bin/env bash
# use: ./docx-to-html.sh /folderpath/
find $1 -type f -name "*.docx" -print0 | while IFS= read -r -d $'\0' FINALNAME; do
BASENAME=$(basename "$FINALNAME" .docx)
DIRNAME=$(dirname "$FINALNAME")
echo "$FINALNAME"
pandoc -t html -o "$DIRNAME/$BASENAME.html" "$FINALNAME"
done