Skip to content

Instantly share code, notes, and snippets.

View jnareb's full-sized avatar

Jakub Narębski jnareb

View GitHub Profile
@jnareb
jnareb / git repo
Created September 10, 2008 20:01
diagram of exchanging commits in equal repositories
[A public repo] [B public repo]
^ \ / ^
| \ / |
{push} {fetch, pull} {push}
| / \ |
| / \ |
| v v |
@jnareb
jnareb / gitweb-ddd.sh
Created November 23, 2008 23:05
gitweb-ddd.sh, debugging CGI app (gitweb) with DDD
#!/bin/sh
export GATEWAY_INTERFACE="CGI/1.1"
export HTTP_ACCEPT="*/*"
export REQUEST_METHOD="GET"
export QUERY_STRING=""$1""
export PATH_INFO=""$2""
ddd "/home/local/gitweb/gitweb.cgi"
@jnareb
jnareb / "git diff --no-index" and <(cmd ...)
Created January 30, 2010 17:23
"git diff --no-index" and <(cmd ...)
# git diff --no-index <(git show 9c209b3) <(git show HEAD)
diff --git 1/dev/fd/63 2/dev/fd/62
index 4425a15..72b7505 120000
--- 1/dev/fd/63
+++ 2/dev/fd/62
@@ -1 +1 @@
-pipe:[61942106]
\ No newline at end of file
+pipe:[61942108]
\ No newline at end of file
@jnareb
jnareb / mastermind-solver.pl
Created February 6, 2010 01:15
mastermind-solver.pl, using Algorithm::Mastermind from CPAN
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use Algorithm::MasterMind::Partition_Worst;
use Term::ReadLine;
my $code_length = 4;
@jnareb
jnareb / plackup running gitweb via WrapCGI
Created April 27, 2010 22:25
bug in plackup running gitweb via WrapCGI, fixed in CGI::Emulate::PSGI 0.07
HTTP::Message content must be bytes at /home/jnareb/perl5/lib/perl5/CGI/Parse/PSGI.pm line 55
1. in Plack::Middleware::StackTrace::__ANON__ at /usr/lib/perl5/5.8.6/Carp.pm line 269
266: # or simply report the caller's package (croak() and carp()), respectively.
267: # confess() and croak() die, carp() and cluck() warn.
268:
269: sub croak { die shortmess @_ }
270: sub confess { die longmess @_ }
271: sub carp { warn shortmess @_ }
@jnareb
jnareb / difference between Dumper($environtment) for HTTP::Server::PSGI and HTTP::Servere::Simple::PSGI
Created May 2, 2010 02:53
difference between Dumper($environtment) for HTTP::Server::PSGI and HTTP::Servere::Simple::PSGI
--- log.1 2010-05-02 04:49:06.000000000 +0200
+++ log.2 2010-05-02 04:49:23.000000000 +0200
@@ -1,7 +1,7 @@
-HTTP::Server::PSGI: Accepting connections at http://0:5000/
+HTTP::Server::Simple::PSGI: Accepting connections at http://0:5000/
$VAR1 = {
- 'SERVER_NAME' => 0,
'SCRIPT_NAME' => '',
+ 'SERVER_NAME' => 'localhost.localdomain',
'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
@jnareb
jnareb / plackup_conf from git-instaweb.sh
Created May 20, 2010 21:26
plackup_conf from git-instaweb
plackup_conf () {
cat > "$fqgitdir/gitweb/gitweb.psgi" <<GITWEB_PSGI_EOF
#!$PERL
# gitweb - simple web interface to track changes in git repositories
# PSGI wrapper (see http://plackperl.org)
use strict;
use IO::Handle;
@jnareb
jnareb / gitweb.psgi
Created May 28, 2010 10:35
gitweb.psgi generated by git-instaweb
#!/usr/bin/perl
# gitweb - simple web interface to track changes in git repositories
# PSGI wrapper and server starter (see http://plackperl.org)
use strict;
use IO::Handle;
use Plack::MIME;
use Plack::Builder;
@jnareb
jnareb / benchmark_caching_interface.pl
Created July 27, 2010 01:59
Benchmark for gitweb caching engine
#!/usr/bin/perl
use lib (split(/:/, $ENV{GITPERLLIB}));
use warnings;
use strict;
use File::Spec;
use File::Path;
use Benchmark qw(:all);
@jnareb
jnareb / gist:674952
Created November 13, 2010 00:26
parallel_run in Test::More, with testing children output
#!/usr/bin/perl
use warnings;
use strict;
use diagnostics;
use POSIX qw(dup2);
use IO::Handle;
use IO::Select;
use IO::Pipe;