Skip to content

Instantly share code, notes, and snippets.

View fliphess's full-sized avatar

Flip Hess fliphess

View GitHub Profile
@fliphess
fliphess / simple_upload_tester.php
Last active March 3, 2017 13:03
Test php file uploads with this simple upload tester borrowed from techstream.org
<?php
/*
* Simple file Upload system with PHP.
* Created By Tech Stream
* Original Source at http://techstream.org/Web-Development/PHP/Single-File-Upload-With-PHP
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@fliphess
fliphess / speedtest.sh
Created February 14, 2017 16:03
Test websites using curl
#!/bin/bash
URL="$1"
if [ "x${URL}" == "x" ] || [[ ! "${URL}" =~ "http" ]] ; then
echo "Usage: $0 <url>"
exit 1
fi
curl -L -so /dev/null -w "\n[Info]\n\nStatus Code:\t%{http_code}\nHTTP Version:\t%{http_version}\nRemote IP:\t%{remote_ip}\n\n[Timing]\n\nConnect:\t%{time_connect}\tseconds\nPre-Transfer:\t%{time_pretransfer}\tseconds\nRedirect Time:\t%{time_redirect}\tseconds\nTransfer:\t%{time_starttransfer}\tseconds\nDNS Lookup:\t%{time_namelookup}\tseconds\nTotal Time:\t%{time_total}\tseconds\n\n[Size]\n\nDownload Size:\t%{size_download}\tbytes\nHeader Size:\t%{size_header}\tbytes\nRequest Size:\t%{size_request}\tbytes\n" $URL ; echo
@fliphess
fliphess / sentry.py
Last active December 13, 2022 20:02
Ansible sentry callback plugin - Send all errors from ansible to Sentry
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import getpass
import logging
import logging.config
import os
import socket
try:
@fliphess
fliphess / proxy-wordpress.md
Last active January 11, 2017 10:44
proxy to wordpress on a cluster domain from a hypernode

Proxy wordpress from a hypernode to a cluster domain

Run on cluster shellserver

  • Install wp cli on cluster shellserver:
# Download wp cli
test -d ~/bin || mkdir ~/bin
wget -O ~/bin/wp-cli https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
@fliphess
fliphess / convert-log-to-combined.py
Last active May 18, 2017 08:51
Convert hypernode nginx json logging to apache combined log format
#!/usr/bin/env python
""" Minimal script to convert json access logging on nginx to combined log format.
To use, save the file as convert.py and make it executable: chmod +x convert.py
Then you can convert the files using cat:
cat access.log | ./convert.py
This will send the log output to stdout, and a lines ignore count to sderr.
"""
import sys
@fliphess
fliphess / iterm_open_with
Created December 15, 2016 14:33 — forked from peterjaap/iterm_open_with
Open text files from Iterm2 in PhpStorm by command+clicking on it
#!/bin/sh
# Open text files from Iterm2 in PhpStorm by command+clicking on it
# You will need the Remote call plugin in PhpStorm - https://plugins.jetbrains.com/plugin/6027
# And of course curl
# wget this and chmod +x it
# then move it to somwhere convenient in your path (such as /usr/local/bin)
# With respects to https://gist.github.com/trinitronx/f59a8308d42d71fdba41 for the basis for this
# iterm_open_with - open a URL, file from CWD, full path, or path with linenumber in default app or PhpStorm if text file
@fliphess
fliphess / ioncube.md
Last active February 15, 2017 14:49
Use ioncube on hypernode Cron and or cli only

Ioncube gebruiken op hypernode voor cronjobs op php7

Dit werkt niet voor php-fpm, alleen voor de cli (crons)

  • Download de ioncube loader voor php7
  • Unpack de loader en rename naar ioncube_loader.so en plaats de file in /data/web/ioncube
  • Maak een config file aan: echo 'zend_extension=/data/web/ioncube/ioncube_loader.so' >> /data/web/ioncube/ioncube.ini
  • Dan kan je in deze ini zelf handmatig de ioncube extensie loaden en aan de juiste php binary als config meegeven:
@fliphess
fliphess / fnfix.py
Created December 6, 2016 11:27 — forked from MicahElliott/fnfix.py
Fix ugly file names to be UNIX shell-friendly.
#! /usr/bin/env python
"""Fix ugly file names to be UNIX shell-friendly.
PROBLEM
=======
You have files named with funky characters lying around in your
filesystem. Ugly files like "My Document #3 - (2005)[1].txt" are
common when you're sharing directories with Windows users, but you
@fliphess
fliphess / yt.sh
Created December 5, 2016 11:40
Download youtube clips and save as mp3
#!/bin/bash
# Install youtube-dl first: `brew install youtube-dl`
URL="$1"
## Validate input
if [ "x$URL" == "x" ] ; then
echo "Usage: $0 <youtube url>"
exit 0;
fi
@fliphess
fliphess / ioncube.md
Last active February 15, 2017 14:49
ioncube op shellserver

Ioncube gebruiken op de shellserver @ byte voor cronjobs op php5.6 terwijl de site op php7 draait

  • Je kan in je environment op de shellserver zien welke php ini gebruikt wordt:
$ env | grep PHP
PHP56RC=/etc/php-klant-configs/php56/devguppie.com/
PHP70RC=/etc/php-klant-configs/php70/devguppie.com/
PHP55RC=/etc/php-klant-configs/php55/devguppie.com/
PHP54RC=/etc/php-klant-configs/php54/devguppie.com/