Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian M. Grube seraphyn

View GitHub Profile
@seraphyn
seraphyn / .htaccess
Created Jul 6, 2020 — forked from seoagentur-hamburg/.htaccess
UPDATE 2019/07: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
View .htaccess
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2020
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
View mycli-ssh
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Use mycli (http://mycli.net/) through ssh
Usage:
$ mycli-ssh yourhost [extra args passed to mycli]
"""
@seraphyn
seraphyn / createuserdb
Created Feb 27, 2019
Script for simple creation of an user including database
View createuserdb
#!/bin/bash
PASS=`pwgen -s 40 1`
USER=`pwgen -B 10 1`
mysql -uroot <<MYSQL_SCRIPT
CREATE DATABASE $USER;
CREATE USER '$USER'@'localhost' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON $USER.* TO '$USER'@'localhost';
FLUSH PRIVILEGES;
MYSQL_SCRIPT
@seraphyn
seraphyn / update_bl.sh
Created Oct 16, 2018
filterlists for unbound in opnsene. Services: Unbound DNS: General > Custom options > include:/var/unbound/ad-blacklist.conf
View update_bl.sh
#!/bin/sh
echo "Removing old files..."
[ -f /tmp/hosts.working ] && rm -f /tmp/hosts.working
whitelist='/(api.solvemedia.com)/'
blacklist='https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts http://sysctl.org/cameleon/hosts https://adaway.org/hosts.txt http://hosts-file.net/ad_servers.txt http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&amp;mimetype=plaintext '
for url in $blacklist; do
curl --silent $url >> "/tmp/hosts.working"
@seraphyn
seraphyn / cfg_dock.lua
Last active Dec 6, 2016
Mein Theme für Notion den Windowmanager
View cfg_dock.lua
de.substyle("active-unselected", {
background_colour = "#ffffff",
--
-- Ion dock module configuration
--
-- Create a dock
mod_dock.create{
-- Dock mode: embedded|floating
mode="floating",
@seraphyn
seraphyn / block_china_ufw.sh
Created Oct 7, 2016 — forked from lewg/block_china_ufw.sh
UFW blocks for China, Korea, Malaysia, Phillipines, Singapore, Thailand and Vietnam netblocks
View block_china_ufw.sh
#!/bin/sh
# UFW blocks for China, Korea, Malaysia, Phillipines, Singapore, Thailand and Vietnam netblocks
# Based on http://www.wizcrafts.net/chinese-iptables-blocklist.html
# Cambodia (KH)
ufw deny from 114.134.184.0/21 to any port 22
# Chinese (CN) IP addresses follow:
ufw deny from 1.192.0.0/13 to any port 22
ufw deny from 1.202.0.0/15 to any port 22
@seraphyn
seraphyn / wp-cron-mu.php
Created Sep 19, 2016
Multisitecron für WordPress. */2 * * * * www-data /usr/bin/php /var/www/html/wordpress/wp-cron-mu.php > /dev/null
View wp-cron-mu.php
<?php
if( php_sapi_name() !== 'cli' ) {
die("Meant to be run from command line.\n");
}
// Modify this based on site domain
$_SERVER['HTTP_HOST'] = 'yoursite.com';
define( 'WP_USE_THEMES', false );
global $wp, $wp_query, $wp_the_query, $wp_rewrite, $wp_did_header;
@seraphyn
seraphyn / atomupdate.sh
Created Sep 7, 2016
Automatic update for the editor atom
View atomupdate.sh
#!/bin/bash
wget -q https://github.com/atom/atom/releases/latest -O /tmp/latest
MATCHEDROW=$(awk -F '[<>]' '/href=".*atom-amd64.deb/' /tmp/latest)
LATEST=$(echo $MATCHEDROW | grep -o -P '(?<=href=").*(?=" rel)')
VER_LATEST=$(echo $MATCHEDROW | rev | cut -d"/" -f 2 | rev | sed 's/v//g')
VER_INST=$(dpkg -l atom | tail -n1 | tr -s ' ' | cut -d" " -f 3)
if [ "$VER_LATEST" != "$VER_INST" ]; then
wget --progress=bar -q "https://github.com/$LATEST" -O /tmp/atom-amd64.deb --show-progress
dpkg -i /tmp/atom-amd64.deb
echo "Atom has been update from $VER_LATEST to $VER_INST"
@seraphyn
seraphyn / dist-upgrade.yml
Created Aug 5, 2016
Fallback and logging in dist-upgrade via ansible ansible-playbook dist-upgrade.yml -i your_inventory [-l host_name]
View dist-upgrade.yml
---
- hosts:
all
gather_facts: no
vars:
verbose: false
log_dir: "log/dist-upgrade/{{ inventory_hostname }}"
pre_tasks:
- block:
- setup:
View gist:85c7fc5c61eefafc4d5635dc5e5d7eb9
[gallery columns="1" ids="257972,257974,257975,257976,257979,257980,257981,257982,257983,257984,257985,257986,257987,257988,257989,257990,257991,257992,257993,257994,257995,257996,257997,257998,257999,258000,258001,258002,258003,258004,258005,258006,258007,258008"]
You can’t perform that action at this time.