Skip to content

Instantly share code, notes, and snippets.

View spagu's full-sized avatar
💭
I may be slow to respond.

Mona Lisa spagu

💭
I may be slow to respond.
View GitHub Profile
@spagu
spagu / docx-to-html.sh
Created February 24, 2018 00:12
Script to convert DOCX to HTML using bash and pandoc
#!/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
@spagu
spagu / pre-commit
Last active November 19, 2020 22:57
subversion pre-commit hook for PHP lint, PSR-2 and CSS validation + comments
#!/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 / expiry_sslcheck.sh
Created September 4, 2018 22:24
expiry_sslcheck.sh is a tool for monitoring SSL domains to avoid expiration date.
#!/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 / any2webp.sh
Created March 30, 2019 20:07
Converts any image to webp
#!/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 / setup-kubernetes-centos-7.md
Last active October 26, 2019 09:59
Install a Master Kubernetes Cluster on Centos 7

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 / block-spam-ip-dnsmasq.sh
Created October 1, 2019 15:03
Get and block IP address for DNSMASQ and PFCTL
#!/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 / docker-compose.yml
Created November 29, 2019 04:24
Wordpress docker-compose
version: '3.3'
services:
nginx:
image: nginx:latest
ports:
- '80:80'
volumes:
- ./nginx:/etc/nginx/conf.d
- ./logs/nginx:/var/log/nginx
@spagu
spagu / artowoo.sh
Created March 13, 2020 08:38 — forked from protorob/artowoo.sh
Bash Sript to Automate the Configuration of the Artomultiplo's Woocommerce Starter Kit
#!/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 / log2hrs.py
Created November 8, 2020 21:10
List vsftpd log entries that are 2 days old only (slow version)
#!/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):