Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
#
###########################################################################
# frameworkdeployqt.pl v.1.0.1 - a script for deploying frameworks #
# that are using Qt libs #
# #
# Copyright (C) 2009 Dominik Kapusta <d@ayoy.net> #
# #
# 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 #
Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.208
diff -u -F '^f' -r1.208 file.inc
--- includes/file.inc 30 Apr 2010 01:33:17 -0000 1.208
+++ includes/file.inc 10 May 2010 18:45:06 -0000
@@ -343,9 +343,21 @@ function file_create_url($uri) {
$scheme = file_uri_scheme($uri);
<?php
function find_element($form, $element_type) {
if (isset($form['#type']) && $form['#type'] == $element_type) {
return $form;
}
else {
foreach (element_children($form) as $name) {
if (is_array($form[$name])) {
$element = find_element($form[$name], $element_type);
if ($element !== FALSE) {
var setTextMeasure = function (contentElement, targetMeasure, maxSize, minSize) {
if (!contentElement) contentElement = document.createElement('p');
if (!targetMeasure) targetMeasure = 66;
if (!maxSize) maxSize = 16;
if (!minSize) minSize = 9;
var sizer = contentElement.cloneNode();
sizer.style.cssText = 'margin: 0; padding: 0; color: transparent; background-color: transparent; position: absolute;';
@wimleers
wimleers / qeventlogger.patch
Created October 30, 2010 08:56
Adds QEventLogger (commit: 31aae3b633c899ee7b91) to Sudoku (commit: cf6ed6c6f2bf76363549)
diff --git src/SudokuApp.cpp src/SudokuApp.cpp
index 3232b0f..18ae303 100644
--- src/SudokuApp.cpp
+++ src/SudokuApp.cpp
@@ -42,6 +42,10 @@ SudokuApp::SudokuApp(int & argc, char ** argv) : QApplication(argc, argv) {
m_mainWindow = new MainWindow();
m_mainWindow->show();
+
+ // Initialize & install the event logger.
@wimleers
wimleers / dps-cdn-rsync.sh
Created October 31, 2010 23:58
Script that syncs a directory recursively to a Push CDN using rsync.
#!/bin/sh
LOGFILE=/data/logs/dps-cdn-rsync/$(date "+%Y-%m").log
# Append a header first, so we know when this script was run.
date "+%n%n=====%nSyncing DriverPacks to CDN at %Y-%m-%d %H:%M:%S" >> $LOGFILE
# Now perform the actual syncing, still appending to the logfile.
rsync -avv --progress --delete --exclude lost+found --exclude .ssh --exclude .bash_history /data/www/downloadsorigin.driverpacks.net/ dpsdl.drupalcdn@storage01.netdna.com:/home/dpsdl.drupalcdn/public_html/ >> $LOGFILE
@wimleers
wimleers / crontab
Created November 1, 2010 00:00
DriverPacks.net server crontab file
#
# Normal cronjobs.
# m h dom mon dow command
#
# Regenerate torrents.tar.gz every hour.
*/60 * * * * tar -cvzf /data/www/svn_driverpacks.net/files/torrents.tar.gz /data/www/svn_driverpacks.net/files/torrents/*.torrent
# Run DriverPacks CDN and seedbox rsync scripts (for downloads)
*/20 * * * * /home/wim/cronscripts/dps-cdn-rsync.sh
@wimleers
wimleers / .htaccess
Created November 2, 2010 13:29
Improved .htaccess for Drupal.
# Disable the server signature.
ServerSignature Off
# No-www.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
@wimleers
wimleers / gist:702387
Created November 16, 2010 19:55
How to convert from a custom date format into a UTC string using Qt.
QDateTime timeConvertor;
QString customDateString = "14-Nov-2010 05:27:03 +0100";
QString dateTime = customDateString.left(20);
int timezoneOffset = customDateString.right(5).left(3).toInt();
timeConvertor = QDateTime::fromString(dateTime, "dd-MMM-yyyy HH:mm:ss");
// Mark this QDateTime as one with a certain offset from UTC, and set that
// offset.
timeConvertor.setTimeSpec(Qt::OffsetFromUTC);
@wimleers
wimleers / gist:706420
Created November 19, 2010 11:52
OpenTracker stats
http://tracker.driverpacks.net:6969/stats?mode=tpbs&format=ben
-> per torrent: hash (ben-encoded), complete, downloaded, incomplete
http://tracker.driverpacks.net:6969/stats?mode=tpbs&format=txt
-> per torrent: hash, seeders, leechers
http://tracker.driverpacks.net:6969/stats?mode=statedump
-> per torrent: hash, base (time in minutes since epoch when the torrent last had >0 peers, *60 = unix timestamp), downloaded