Skip to content

Instantly share code, notes, and snippets.

@juster
juster / provides.rkt
Created June 10, 2014 14:40
Scheme code to generate a "provide" list for ArchLinux's perl package.
#lang racket
;; Generate a provides list for the ArchLinux perl package. Scan the appropriate directories
;; under the perl source tree for directories containing distributions, suitable for CPAN.
;; Search the files in the distributions for VERSION strings, which are perl expressions.
;; Filters these version strings through the perl interpreter, then transform the dist.
;; names and versions into package names and versions. This last step is much easier now.
;; The perl source tree has been greatly organized since even 5.18.
(define perl-src-dir "/Users/juster/src/perl-5.20.0")
@juster
juster / patchprov
Last active August 29, 2015 14:02
Script for patching the provides list in the ArchLinux PKGBUILD for the perl package.
#!/usr/bin/perl
##
## Name:
## patchprov
##
## Description:
## Patch the provides list in the perl package PKGBUILD. Scan the appropriate
## directories under the perl source tree for directories containing dists
## similar to CPAN dists. Search the files in the distributions for VERSION
## strings, which are perl expressions. Filters these version strings through
--- perl-5.20.0/vutil.c 2014-05-26 09:34:21.000000000 -0400
+++ perl-5.20.0-patched/vutil.c 2014-06-19 09:25:19.024409700 -0400
@@ -585,11 +585,29 @@
{
STRLEN len;
+#ifdef USE_LOCALE_NUMERIC
+ char *loc = setlocale(LC_NUMERIC, NULL);
+ if (loc) {
+ /* setlocale returns NULL on error */
@juster
juster / sotree
Last active August 29, 2015 14:07
Print min spanning tree of dep graph for dynamic libraries.
#!/usr/bin/awk -f
##
# sotree
# Prints a dynamic library dependency graph as a minimum spanning tree.
# Justin Davis 10/14/14
##
BEGIN {
libdircnt = split("/lib:/usr/lib:" ENVIRON["LD_LIBRARY_PATH"], libdirs, /:/)
if(!libdirs[libdircnt]) --libdircnt
digraph "Bash Grammar" {
pipeline_command -> command
command -> simple_command
command -> shell_command
command -> function_def -> function_body
shell_command -> for
shell_command -> case
-- lisp.lua
-- by Justin Davis <jrcd83@gmail.com>
-- Very light data abstraction.
local nullval = {}
local function pair_exp (exp)
return type(exp) == "table" and exp.left ~= nil and exp.right ~= nil
end
@juster
juster / templ.awk
Created September 2, 2015 22:31
Tiny awk web template
function die (msg)
{
printf "%s:%d %s\n", FILENAME, FNR, msg > "/dev/stderr"
exit 1
}
BEGIN { FS="{!}"; OFS="" }
NF > 0 && NF % 2 == 0 { die("Unbalanced {!} tokens.") }
NF > 2 {
for (i=2; i<=NF; i+=2) {
# CPAN Name : Modern-Perl
[% WRAPPER wrapper.tt %]
build() {
DIST_DIR="${srcdir}/[% distdir %]"
export PERL_MM_USE_DEFAULT=1
{ cd "$DIST_DIR" &&
[% IF is_makemaker %]
perl Makefile.PL INSTALLDIRS=vendor &&
make &&
[% IF skiptest %]#[% END %]make test &&
#!/usr/bin/perl
use warnings;
use strict;
use 5.010;
use File::Spec::Functions qw(catfile);
sub make_inc_hook
From 8e993c74faf873d159dcedfe90ae323930312663 Mon Sep 17 00:00:00 2001
From: Justin Davis <jrcd83@gmail.com>
Date: Fri, 14 May 2010 20:38:46 -0700
Subject: [PATCH] Fix broken -I option for plackup.
Explicitly 'require lib' before we try to use lib->import.
---
lib/Plack/Runner.pm | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)