Skip to content

Instantly share code, notes, and snippets.

@jonyesno
jonyesno / wp-fixup-tag.php
Created January 20, 2012 04:55
Script that sets WordPress's 'tag base' to 'filter' and nudges the rebuild stuff
<?php
if ( !defined('ABSPATH') ) {
require_once('./wp-load.php');
}
print "<pre>\n";
$wp_rewrite->set_category_base('');
$wp_rewrite->set_tag_base('filter');
$category_base = get_option('category_base');
@jonyesno
jonyesno / irrsi.patch
Created November 14, 2011 18:19
Patch to stop irssi from using SSLv2 ciphers
diff -ur irssi-0.8.15.orig/src/core/network-openssl.c irssi-0.8.15/src/core/network-openssl.c
--- irssi-0.8.15.orig/src/core/network-openssl.c 2010-04-03 17:19:38.000000000 +0100
+++ irssi-0.8.15/src/core/network-openssl.c 2011-10-24 14:51:40.000000000 +0100
@@ -401,7 +401,7 @@
if(!(fd = g_io_channel_unix_get_fd(handle)))
return NULL;
- ctx = SSL_CTX_new(SSLv23_client_method());
+ ctx = SSL_CTX_new(SSLv3_client_method());
if (ctx == NULL) {
@jonyesno
jonyesno / gist:1270440
Created October 7, 2011 14:54
Apple mail.me.com mixed certificates
$ dig a mail.me.com
; <<>> DiG 9.7.3 <<>> a mail.me.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26639
;; flags: qr rd ra; QUERY: 1, ANSWER: 10, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;mail.me.com. IN A
@jonyesno
jonyesno / vm-sizes.rb
Created September 21, 2011 09:37
Total up KVM / qemu VM sizes from ps(1) output
#!/usr/bin/env ruby
sizes = []
IO.popen("ps waux") do |pipe|
pipe.each do |line|
next unless line.match(/qemu/)
vm = line.match(%r{qemu/(\w+)\.monitor})[1]
bits = line.split(/\s+/)
vsz, rss = bits[4,5]
sizes.push({ :vm => vm, :vsz => vsz, :rss => rss })
* jon has the router password .... muhahahahahah!
<jon> all of XXXXXXXX is now in my hands ....!
<jon> and we have no management until Tuesday ....
-!- jon [jon@XXXXXXXXXXXXXX.com] has quit [Ping timeout]
...
21:48 < gary> now to try my firewall vm, probably disappear for a bit
21:49 < v732> good luck out there gary
21:49 < chris> -!- gary has quit [ping timeout] # traditional at this point
@jonyesno
jonyesno / patch-saslauthd::auth_rimap.c
Created June 11, 2011 15:08
Prevent saslauthd spinning on usernames or passwords containing "
--- saslauthd/auth_rimap.c.orig 2011-06-11 15:58:59.000000000 +0100
+++ saslauthd/auth_rimap.c 2011-06-11 16:01:37.000000000 +0100
@@ -163,6 +163,7 @@
p1 = s;
while ((p1 = strchr(p1, '"')) != NULL) {
num_quotes++;
+ p1++;
}
if (!num_quotes) {
@jonyesno
jonyesno / day-counter.rb
Created June 7, 2011 06:46
More on that 'special' month thing
#!/usr/bin/env ruby
# a rework of https://gist.github.com/612030 which only considered Octobers
require 'date'
require 'pp'
start = 1852 # when Gregorian calendar started
finish = Date.today.year
special = []
@jonyesno
jonyesno / mount-cfs.sh
Created May 31, 2011 12:55
OS X crypto fs mounter
#!/bin/sh
CFS="key: zomo: mobilesync:-nobrowse documents:-nobrowse"
for _C in ${CFS} ; do
C=${_C/:*/} # fs
O=${_C/*:/} # options
DMG=${HOME}/cfs/${C}.dmg
if [ ! -f ${DMG} ] ; then
@jonyesno
jonyesno / ddar-bsd.patch
Created April 28, 2011 08:13
Patch to build ddar on BSD / OS X
--- scan.c.orig 2011-04-28 08:28:05.000000000 +0100
+++ scan.c 2011-04-28 09:01:10.000000000 +0100
@@ -38,6 +38,14 @@
#define likely(x) __builtin_expect(x, 1)
#define unlikely(x) __builtin_expect(x, 0)
+#ifndef __linux__
+#define TEMP_FAILURE_RETRY(expr) \
+ ({ long int _res; \
+ do _res = (long int) (expr); \
@jonyesno
jonyesno / defer-mail.sh
Created February 17, 2011 13:52
Exim mail defer script
#!/bin/sh
# http://www.exim.org/exim-html-current/doc/html/spec_html/ch29.html
#
# script to run under Exim's pipe transport that returns the magic
# exit code such that exim defers delivery
#
# relies on defaults for temp_errors setting
#
# useful to put piped mail handling on hold during maintenance
exit 75