Skip to content

Instantly share code, notes, and snippets.

View avar's full-sized avatar

Ævar Arnfjörð Bjarmason avar

View GitHub Profile
abbadís
Árdís
arís
Arndís
Ásdís
bakarís
bergdís
bjarndís
borgarís
brennisteinskís
$ git diff -U15
diff --git a/git-compat-util.h b/git-compat-util.h
index bd04564a69..38c806acff 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -119,30 +119,37 @@
#define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
#if defined(__sun__)
/*
#!/bin/bash
for i in $(seq 10 100); do
echo "$i ($(date)):"
git rev-list origin/master|perl -0777 -nE "srand($i); my @r = sort { rand() <=> rand() } split /\n/, \$_; for (0..8) { say qq[\$r\[\$_\]:\$r\[-\$_\]] }" >/tmp/commit-list
#cat /tmp/commit-list
echo ".. doing faster ($(date)):"
parallel -k -j 8 '
A=$(echo {} | cut -d: -f1)
@avar
avar / gitweb.pl
Created September 21, 2016 10:49
$line = esc_html($line, -nbsp=>1);
$line =~ s{
\b
(
# The output of "git describe", e.g. v2.10.0-297-gf6727b0
# or hadoop-20160921-113441-20-g094fb7d
use v5.14.2;
use strict;
use warnings;
use Inline::Perl6;
my $p6 = Inline::Perl6->new;
my $app = sub {
my @ret = $p6->run(<<'P6');
sub main {
http_port 127.0.0.1:3128
http_access allow localhost manager
http_access deny manager
http_access allow localhost
http_access deny all
cache_peer webproxy.corp.example.com parent 3128 0 no-query proxy-only default ssl sslflags="DONT_VERIFY_PEER NO_DEFAULT_CA DONT_VERIFY_DOMAIN"
never_direct allow all
cache deny all
access_log daemon:/var/log/squid3/access.log squid
cache_log /var/log/squid3/cache.log
) = 1 (in [3], left {569, 430925})
accept(3, 0, NULL) = 4
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR) = 0
read(4, "", 1) = 0
close(4) = 0
select(4, [3], NULL, NULL, {600, 0}) = 1 (in [3], left {599, 999375})
accept(3, 0, NULL) = 4
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR) = 0
@avar
avar / safely_write.pl
Last active August 29, 2015 14:19
An example of writing long JSON lines to a file atomically with Perl while warning about writes in excess of PIPE_BUF
use strict;
use warnings;
use JSON::XS ();
use POSIX qw(PIPE_BUF);
my $PATH = ...;
my $DATA = ...;
my $TIME = time;
my $JSON = JSON::XS->new->ascii(1)->indent(0);
@avar
avar / prune-benchmark.sh
Last active August 29, 2015 14:16
Ad-hoc benchmark script for git fetch --prune v.s. git remote prune
#!/bin/bash -xe
# Clone git.git
cd /tmp/
rm -rf git
if ! test -d git
then
git clone --reference ~/g/git https://code.google.com/p/git-core/ git
fi
@avar
avar / build-perl6-from-git
Created February 5, 2015 18:11
A very basic builder for the Perl 6 MoarVM+NQP+Rakudo distributions, which installs them into a given target
#!/bin/sh -xe
root=/tmp/usr
prefix=$root/local/my-perl6/blead
work=/tmp/perl6-git
jobs=18
rm -rfv $root $work || :
mkdir $work
cd $work