Skip to content

Instantly share code, notes, and snippets.

@perbu
perbu / sessionlog.pl
Created August 22, 2013 11:11
Quick and dirty way to split varnish log stream into separate file.
use IO::File;
while($logline = <>) {
($n) = $logline =~ m/\s+(\d+)/;
unless ($F{$n}) {
print "New FD: $n\n";
$F{$n} = IO::File->new("$n.log", "w")
};
$F{$n}->print($logline);
}
@perbu
perbu / gist:f492d25448bde3f6de12
Created March 6, 2015 19:03
subprocess is lame
#!/usr/local/bin/python
import subprocess
output = "not set"
try:
output = subprocess.check_output(["ls", "/", "/foo"])
print "success!"
print(output)
except subprocess.CalledProcessError:
print "fail!"
print output # will output "not set"
2015-03-08 10:55:21 +0100
./configure
--disable-debug
--disable-dependency-tracking
--prefix=/usr/local/Cellar/dosbox/0.74
--mandir=/usr/local/Cellar/dosbox/0.74/share/man
--disable-sdltest
--enable-core-inline
#!/usr/local/bin/python
import getopt
import threading
import Queue
import time
import glob
import subprocess
import sys
import os
Recipe: Sgabuzzino rosso
Brewer: Per Buer
Asst Brewer:
Style: Classic American Pilsner
TYPE: All Grain
Taste: (30.0)
Recipe Specifications
--------------------------
Boil Size: 32.33 l
sub vcl_hit {
if (obj.ttl >= 0s) {
# normal hit
return (deliver);
}
# We have no fresh fish. Lets look at the stale ones.
if (std.healthy(req.backend_hint)) {
# Backend is healthy. Limit age to 10s.
if (obj.ttl + 10s > 0s) {
set req.http.grace = "normal(limited)";
vcl 4.0;
import curl;
import cookie;
import std;
backend default {
.host = "127.0.0.1";
.port = "8000";
}
#!/usr/bin/perl
use strict;
use warnings;
use Digest::MD5 qw(md5);
use base qw(Net::Server::HTTP);
[874377.384908] ata7.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[874377.392102] ata7.00: failed command: FLUSH CACHE EXT
[874377.397198] ata7.00: cmd ea/00:00:00:00:00/00:00:00:00:00/a0 tag 0
[874377.397198] res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
[874377.410958] ata7.00: status: { DRDY }
[874377.414753] ata7: hard resetting link
[874387.767905] ata7: softreset failed (1st FIS failed)
[874387.772922] ata7: hard resetting link
[874398.128877] ata7: softreset failed (1st FIS failed)
[874398.133885] ata7: hard resetting link
[ 25%] Building CXX object CMakeFiles/diskbuilder.dir/main.cpp.o
In file included from /Users/perbu/git/IncludeOS/diskimagebuild/main.cpp:10:
/Users/perbu/git/IncludeOS/diskimagebuild/filetree.hpp:22:15: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions]
template <int Mult = SECT_SIZE>
^ ~~~~~~~~~
/Users/perbu/git/IncludeOS/diskimagebuild/filetree.hpp:54:10: error: no member named 'emplace_back' in 'std::__1::vector<Dir, std::__1::allocator<Dir> >'
subs.emplace_back(path);
~~~~ ^
/Users/perbu/git/IncludeOS/diskimagebuild/filetree.hpp:59:11: error: no member named 'emplace_back' in 'std::__1::vector<File, std::__1::allocator<File> >'
files.emplace_back(path);