Skip to content

Instantly share code, notes, and snippets.

@wimleers
wimleers / opentracker-reload-whitelist.sh
Created November 19, 2010 14:12
Send a signal to opentracker to reload its whitelist
#!/bin/sh
kill -s HUP `pidof opentracker`
@wimleers
wimleers / .htaccess
Created November 19, 2010 14:15
.htaccess/httpd.conf additions for .torrent support
application/x-bittorrent .torrent
@wimleers
wimleers / opentracker.torrent.php
Created November 19, 2010 15:31
.torrent creator in PHP, for easier Drupal integration in the future.
<?php
/**
* Converts a specified structure into its bencoded form. Acceptable values
* include: integers, strings, arrays, and assoc. arrays.
* Note that associative arrays are encoded into dictionaries while
* non-associative arrays are encoded into lists.
*
* This was copied from http://drupal.org/project/bittorrent
#include <QDateTime>
#include <QTime>
#include <QTextStream>
#define NUM_CALLS 1000
int main(int argc, char *argv[]) {
QTextStream cout(stdout);
QTime timer;
#-------------------------------------------------
#
# Project created by QtCreator 2010-11-20T18:00:03
#
#-------------------------------------------------
QT += core
QT -= gui
@wimleers
wimleers / gist:716034
Created November 25, 2010 22:40
Set this error handler before erroneous code and you'll get a nice report of the exact error, including a brief stack trace. Simple & nice. Who knew. Stupid PHP.
function handler($errno, $errstr, $errfile, $errline) {
throw new Exception($errstr, $errno);
}
set_error_handler('handler');
@wimleers
wimleers / dps-seedbox1-rsync.sh
Created November 29, 2010 12:01
Script that syncs a directory tree recursively to another server, to a single target ("flat") directory, using rsync.
#!/bin/sh
LOGFILE=/data/logs/dps-seedbox1-rsync/$(date "+%Y-%m").log
EXCLUDES_COMMON="--exclude lost+found --exclude .ssh --exclude .bash_history"
EXCLUDES_MORE="--exclude other --exclude BASE --exclude applications"
# Append a header first, so we know when this script was run.
date "+%n%n=====%nSyncing DriverPacks to seedbox1 at %Y-%m-%d %H:%M:%S" > $LOGFILE
# Sync the DriverPacks themselves to the seedbox' 'data' folder. However, we
@wimleers
wimleers / gist:722461
Created November 30, 2010 21:39
Drupal CDN module (http://drupal.org/project/cdn) version 2.0 release notes
I was (finally!) creating the final release for one my modules (the CDN module). I had typed quite a bit in the release notes field. So I wanted to verify that those release notes looked ok, by clicking the Preview button. Unfortunately, that's where things went wrong.
It seems Drupal.org created a *completely* messed up project release node: no version number in the node title (just 'cdn'), no version number in the file name (just 'cdn-.tar.gz'), linked to the correct CVS tag (which I can also not select again when creating a new project release), with a (seemingly) valid tarball, but no release notes. See it for yourself at http://drupal.org/node/985576.
Screenshots attached (fortunately, Google Chrome has an excellent backward cache, which included the form in its full glory).
So:
1) could you please delete that messed up project release node or edit it to have version number 2.0 and the following release notes:
<code>
The goal for 2.0 is simple: make the CDN module kick ass. This will be done in three
@wimleers
wimleers / mantis-1.2.3-to-1.2.4.patch
Created December 15, 2010 14:03
See http://www.mantisbt.org/blog/?p=123. Command used: git diff --no-prefix release-1.2.3..release-1.2.4 > mantis-1.2.3-to-1.2.4.patch
diff --git .gitignore .gitignore
index ad522c6..2a0e079 100644
--- .gitignore
+++ .gitignore
@@ -19,6 +19,9 @@ build/
# Untracked plugins
plugins/*
+!plugins/MantisCoreFormatting
+!plugins/MantisGraph
@wimleers
wimleers / git — branching from an upstream branch.txt
Created December 16, 2010 11:38
git — branching from an upstream branch
--( ~/Work/redbot (master) )-- git remote add upstream https://github.com/mnot/redbot.git
--( ~/Work/redbot (master) )-- git fetch upstream
From https://github.com/mnot/redbot
* [new branch] gh-pages -> upstream/gh-pages
* [new branch] master -> upstream/master
--( ~/Work/redbot (master) )-- git fetch upstream master:har-postData
From https://github.com/mnot/redbot
* [new branch] master -> har-postData
--( ~/Work/redbot (master) )-- git checkout har-postData
Switched to branch 'har-postData'