This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Progress by file descriptors (cp / gz / resize2fs e.t.c.) | |
# | |
# 2013-04-18: | |
# Ability to measure block devices added | |
# Useful to know progress of resize2fs for example. | |
# | |
# Run using `watch` util |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// dump.php [database] [collection] [filename] | |
function dump(MongoCollection $collection, $filename) { | |
$file = fopen($filename, 'w'); | |
foreach ($collection->find() as $document) { | |
fwrite($file, bson_encode($document)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASSERT(curl_easy_setopt(ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP) == CURLE_OK); | |
ASSERT(curl_easy_setopt(ch, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP) == CURLE_OK); | |
// main loop, for all URL's | |
while (1) { | |
CURLcode code; | |
int currentRedirectIteration = 0; | |
long httpResponseCode; | |
char buffer[URL_MAX]; | |
char *url[URL_MAX]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// url | |
fwrite(currentThread->task.url, strlen(currentThread->task.url), 1, f); | |
fwrite("\n", 1, 1, f); | |
// IP | |
curl_easy_getinfo(curlPage.pcHandle, CURLINFO_PRIMARY_IP, &buffer); | |
if (!buffer) { | |
vFprintf("Thread %i: '%s' malformed IP\n", currentThread->thread.internalId, currentThread->task.url); | |
} else { | |
fwrite(buffer, strlen(buffer), 1, f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This shows how to use HTTP chunked transfer in libevent. It starts an HTTP server on port 8080; when the client connects, it outputs an message every second. After all messages are outputted, the server closes the HTTP connection. | |
It has an unsolved crashing problem though... to see it crash, run the next commands in a shell. | |
See my ML post "after the http client abruptly closes socket libevent (2.0.3-alpha) http server crashes" at http://archives.seul.org/libevent/users/Jan-2010/msg00054.html | |
Compile with: | |
gcc -Wall -g -std=c99 -D_GNU_SOURCE -Iinclude -Llib -levent -o chunk chunk.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DSDT @ 0x8ad82000 | |
0000: 44 53 44 54 53 4d 00 00 01 3d 41 50 50 4c 45 20 DSDTSM...=APPLE | |
0010: 4d 61 63 42 6f 6f 6b 50 01 00 09 00 49 4e 54 4c MacBookP....INTL | |
0020: 15 09 10 20 08 53 50 32 4f 0a 4e 08 53 50 31 4f ... .SP2O.N.SP1O | |
0030: 0b 4e 16 08 49 4f 31 42 0b 00 06 08 49 4f 31 4c .N..IO1B....IO1L | |
0040: 0a 70 08 49 4f 32 42 0b 80 06 08 49 4f 32 4c 0a .p.IO2B....IO2L. | |
0050: 20 08 49 4f 33 42 0b 90 02 08 49 4f 33 4c 0a 10 .IO3B....IO3L.. | |
0060: 08 53 50 33 4f 0a 2e 08 49 4f 34 42 0b 20 0a 08 .SP3O...IO4B. .. | |
0070: 49 4f 34 4c 0a 20 08 4d 43 48 42 0c 00 00 d1 fe IO4L. .MCHB..... | |
0080: 08 4d 43 48 4c 0b 00 40 08 45 47 50 42 0c 00 90 [email protected]... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* QLambda wrapper for Qt connect | |
* | |
* File: lambda.cpp | |
* Date: 4/15/2012 | |
* | |
* @link http://www.silmor.de/qtstuff.lambda.php | |
* @link http://stackoverflow.com/questions/4731947/overloading-on-stdfunction | |
* | |
* @package ad-reger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Wrapper::QLambda *lambda = NULL; | |
lambda = new Wrapper::QLambda([this, &captchaHandled, &dialog, lambda] (QObject* qObReply) { | |
// Do some stuff here | |
}, this); | |
_connectAndExecSync(_params->manager, SIGNAL(replyReadyRead(QNetworkReply*)), lambda, SLOT(call(QNetworkReply*))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import random | |
import string | |
from OpenGL.GL import * | |
from PyQt4 import QtGui, QtCore | |
from PyQt4.QtOpenGL import * | |
params = [] | |
class WfWidget(QGLWidget): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feb 21 12:41:15 macbook-pro-sq kernel: [32109.257828] xhci_hcd 0000:00:14.0: setting latency timer to 64 | |
Feb 21 12:41:20 macbook-pro-sq kernel: [32114.260814] xhci_hcd 0000:00:14.0: Timeout while waiting for a slot | |
Feb 21 12:41:20 macbook-pro-sq kernel: [32114.262128] hub 1-0:1.0: couldn't allocate port 2 usb_device | |
Feb 21 12:42:01 macbook-pro-sq kernel: [32154.996365] xhci_hcd 0000:00:14.0: Timeout while waiting for a slot | |
Feb 21 12:42:01 macbook-pro-sq kernel: [32154.997663] hub 1-0:1.0: couldn't allocate port 2 usb_device | |
Feb 21 12:42:30 macbook-pro-sq kernel: [32183.886242] xhci_hcd 0000:00:14.0: Timeout while waiting for a slot | |
Feb 21 12:42:30 macbook-pro-sq kernel: [32183.887644] hub 1-0:1.0: couldn't allocate port 2 usb_device | |
Feb 21 12:43:37 macbook-pro-sq kernel: [32250.832938] [drm:drm_edid_block_valid] *ERROR* EDID checksum is invalid, remainder is 98 | |
Feb 21 12:43:37 macbook-pro-sq kernel: [32250.835517] Raw EDID: | |
Feb 21 12:43:37 macbook-pro-sq kernel: [32250.836802] 00 ff ff ff ff ff ff 00 26 cd |