Skip to content

Instantly share code, notes, and snippets.

@nasieti
nasieti / suhosin-patch-5.3.9-0.9.10.patch.patch
Created March 18, 2013 10:58
this just solves conflicts in the patch caused by year-numbering changes in footers of the php code.the original php 5.3.9 patch then applies cleanly onto vanilla 5.3.28 http://www.hardened-php.net/suhosin/
--- suhosin-patch-5.3.9-0.9.10.patch 2012-01-11 22:05:08.000000000 +0100
+++ suhosin-patch-5.3.22-0.9.10.patch 2013-03-08 20:20:46.000000000 +0100
@@ -5701,21 +5701,21 @@
diff -Nura php-5.3.9/sapi/cgi/cgi_main.c suhosin-patch-5.3.9-0.9.10/sapi/cgi/cgi_main.c
--- php-5.3.9/sapi/cgi/cgi_main.c 2012-01-01 14:15:04.000000000 +0100
+++ suhosin-patch-5.3.9-0.9.10/sapi/cgi/cgi_main.c 2012-01-11 19:36:52.000000000 +0100
-@@ -1932,11 +1932,19 @@
+@@ -1955,11 +1955,19 @@
SG(headers_sent) = 1;
SG(request_info).no_headers = 1;
@nasieti
nasieti / Joomla XML to language INI
Last active December 18, 2015 12:18
Fork a Joomla! extension XML file into a language INI file (#perl oneliner)
1. backup - it may be destructive if you hate perl.
2. review - it does not catch all strings
# export strings for labels and descriptions
perl -ne '$p="PREFIX"; if (/name="(.*?)".*label="(.*?)".*description="(.+?)"/) { $n="\U$1"; $l=$2; $ll=$p."_$n"."_LBL"; $d=$3; $dd=$p."_$n"."_DESC"; s~$l~$ll~; s~$d~$dd~; print "$ll=\"$l\"\n$dd=\"$d\"\n"; }' extension.xml > translation.ini
# replace them with placeholders
perl -i -pe '$p="PREFIX"; if (/name="(.*?)".*label="(.*?)".*description="(.+?)"/) { $n="\U$1"; $l=$2; $ll=$p."_$n"."_LBL"; $d=$3; $dd=$p."_$n"."_DESC"; s~$l~$ll~; s~$d~$dd~; }' extension.xml
@nasieti
nasieti / gist:6822964
Created October 4, 2013 08:50
RSYNC - delete vs exclude
rsync --del will refuse to delete files vanished from source (even when the whole parent dirs are gone), but appear in --exclude directives. you may agree with the logic, or not.
override with --delete-excluded
@nasieti
nasieti / httpd-rotatelogs.diff
Last active August 29, 2015 14:01
httpd/rotatelogs with symlinked logfile
--- httpd-2.2.27/support/rotatelogs.c
+++ httpd-2.2.27/support/rotatelogs.c
@@ -56,6 +56,7 @@
#if APR_HAVE_STRINGS_H
#include <strings.h>
#endif
+#include <unistd.h>
#define BUFSIZE 65536
#define ERRMSGSZ 256
@nasieti
nasieti / .bash_aliases
Last active August 29, 2015 14:05
favorite bash/shell aliases and hacks
# screen hacks
LESS='-MRXFC~'
alias more='less -mFERX~'
# git
alias gi='git add -i'
alias gl='git log --oneline --all --graph --decorate'
alias glp='git log -p'
alias gp='git add -p'
alias gs='git status -b -s -uno'