Skip to content

Instantly share code, notes, and snippets.

View fliphess's full-sized avatar

Flip Hess fliphess

View GitHub Profile
@fliphess
fliphess / detect.py
Last active November 22, 2016 16:42
detect non-ascii chars in a directory with files (Jup it was indeed very sad i needed it)
import ast
import re
import os
search = '/tmp/plop'
def get_nonascii_chars(filename):
with open(filename) as fp:
tree = ast.parse(fp.read())
@fliphess
fliphess / dump-magento-database.sh
Last active October 14, 2016 18:18
Dump a magento database over ssh using a tunnel
#!/bin/bash -x
set -e
RSERVER="remote_server_ip"
RSRV_USER="root"
RHOST="remote_database_ip"
RPORT="3306"
RUSER="some_user"
RPASS="some_pass"
@fliphess
fliphess / test-cipers
Created September 27, 2016 13:11
list / test available ssl ciphers
#!/usr/bin/env bash
# OpenSSL requires the port number.
SERVER="$1"
PORT="$2"
DELAY=0.1
if [ "x${SERVER}" == "x" ] || [ "x${PORT}" == "x" ] ; then
echo "Usage: $0 <server> <port>"
exit 1
@fliphess
fliphess / build.md
Last active October 18, 2016 19:00
Build and use XfreeRDP on linux

Install deps

sudo apt-get install git build-essential git-core cmake libssl-dev libx11-dev libxext-dev libxinerama-dev \
libxcursor-dev libxdamage-dev libxv-dev libxkbfile-dev libasound2-dev libcups2-dev libxml2 libxml2-dev \
libxrandr-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

Get XfreeRDP

clone git://github.com/FreeRDP/FreeRDP.git 
@fliphess
fliphess / redis-stats.php
Last active September 7, 2016 09:20 — forked from blongden/redis-stats.php
Single page website to show statistics on a redis server
<?php
$redis_server = '127.0.0.1';
$redis_port = 6379;
$banned_keys = [
'rdb_changes_since_last_save',
'rdb_bgsave_in_progress',
'rdb_last_save_time',
'rdb_last_bgsave_status',
@fliphess
fliphess / vnstat-wrapper.php
Created August 31, 2016 13:13
A wrapper around vnstat to view network usage of a server
<?php
header('Pragma: no-cache');
header('Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate, proxy-revalidate');
$domain = $_SERVER["SERVER_NAME"];
$url = $_SERVER["SCRIPT_NAME"];
$options = ['summary', 'hours', 'days', 'months', 'top10'];
$option = filter_input(INPUT_GET, "option", FILTER_SANITIZE_STRING);
@fliphess
fliphess / cache-warmer.py
Created August 23, 2016 09:34
Threaded cache warmer for xml sitemaps
#!/usr/bin/env python
import argparse
import multiprocessing.pool as mpool
import os.path
import re
import sys
import time
import requests
import subprocess
@fliphess
fliphess / change-wp-urlconfig.sh
Last active August 22, 2016 15:21
Change url config in wordpress after migrating to a new domain
#!/bin/bash
DOMAIN="$1"
OLD_DOMAIN="$2"
if [ "x$DOMAIN" == "x" ] || [ "x$OLD_DOMAIN" == "x" ] ; then
echo "Usage: $0 <new_domain> <old_domain> (no scheme://)"
exit 1
fi
mysql -Be "UPDATE wp_posts SET guid = REPLACE(guid, 'http://$OLD_DOMAIN/', 'http://$DOMAIN/')"
@fliphess
fliphess / serial-cache-warmer.sh
Created July 26, 2016 09:40
serial cache warmer
#!/bin/bash
if [ "$#" -ne 1 ] || [ "x$1" == "x" ] ; then
echo "Usage: $0 <sitemap.xml>"
exit 0;
fi
if [ ! -f "$1" ]; then
echo "Sitemap file $1 not found! Exit!"
exit 1
@fliphess
fliphess / addblock.sh
Created June 14, 2016 13:21
bind addblock zones
curl -qs http://someonewhocares.org/hosts/ | grep -vE '^#' | grep ^127 | grep -v local | awk '{print $2}' | while read line; do echo "zone \"$line\" { type master; file "/etc/bind/db.empty"; };"; done >> named.conf.fake-zones