Skip to content

Instantly share code, notes, and snippets.

@gmambro
gmambro / php-fcgi-init
Last active August 29, 2015 14:05
Startup script for PHP FCGI - RHEL6 Centos
#!/bin/sh
#
# php-fcgi Startup script for PHP FCGI
#
# chkconfig: 345 86 14
# description: PHP FCGI server
# pidfile: /var/run/php-fcgi/pid
PATH=/sbin:/bin:/usr/bin:/usr/sbin
@gmambro
gmambro / catalyst-fcgi-init
Created August 9, 2014 22:33
RHEL/Centos init script for a Catalyst FCGI server
#!/bin/sh
#
# chkconfig: 345 86 14
# description: MyApp FCGI server
# pidfile: /var/run/myapp/pid
PATH=/sbin:/bin:/usr/bin:/usr/sbin
# Source function library.
. /etc/rc.d/init.d/functions
%define real_name limesurvey
%define limedir %{_var}/www/limesurvey
%define _binaries_in_noarch_packages_terminate_build 0
Name: limesurvey
Version: 2.06.150911
Release: 1%{?dist}
Summary: The limesurvey RPM
Group: System Environment/Base
<Location /limesurvey>
RewriteEngine on
RewriteBase /limesurvey
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\?*$ index.php [QSA,L]
</Location>
When I find myself in times of trouble
tcpdump comes to me
dumping every packet,
let it sniff
And in my hour of darkness
with the console right in front of me
thinking "it's the firewall",
let it sniff
@gmambro
gmambro / login.inc.conf
Last active February 5, 2016 16:57
Configuration for kerberos authentication and ldap authorization with Apache
<Location /login>
Order deny,allow
AuthType Kerberos
AuthName "Trac"
KrbAuthoritative On
KrbVerifyKDC Off
KrbMethodNegotiate On
KrbMethodK5Passwd On
@gmambro
gmambro / trac-backup-sh
Created March 3, 2016 09:43
Simple script for running trac hotcopy
#!/bin/sh
TRAC_ADMIN=$(which trac-admin)
TRAC_LIB=/var/lib/trac
TRAC_BACKUP_DIR=/var/lib/backup/trac
if [ $# != 1 ]; then
echo "usage $0 <env>"
exit 1
fi
@gmambro
gmambro / lazy_property.py
Created March 15, 2016 15:15
Python lazy attribute property
class lazy_property(object):
'''
This decorator is meant to be used for lazy evaluation of an object attribute.
The property should represent non-mutable data, as it replaces itself.
Example:
class Configuration(object):
def __init__(self):
@gmambro
gmambro / keybase.md
Created March 6, 2017 18:25
keybase

Keybase proof

I hereby claim:

  • I am gmambro on github.
  • I am gmambro (https://keybase.io/gmambro) on keybase.
  • I have a public key ASBtZVM7NS6UeBw9ng1Rn47uYSFwOHX84jSj3eSs_Srpewo

To claim this, I am signing this object:

@gmambro
gmambro / encryption.php
Created March 9, 2017 16:47
Simple PHP encryption
class Encryption
{
const CIPHER = 'AES-128-CBC';
/* Cryptographic key of length 16, 24 or 32. NOT a password! */
private $key;
private $iv_size;
public function __construct($key) {
$this->key = $key;