Skip to content

Instantly share code, notes, and snippets.

% perl5.11.0 -le 'eval { undef *$_ } for keys %::'
Attempt to free unreferenced scalar: SV 0x2866aa0, Perl interpreter: 0x283c010.
% perl5.11.0 -e 'eval { $::{"@"}="" }'
perl5.11.0: sv.c:4312: Perl_sv_setpvn: Assertion `sv' failed.
zsh: abort LC_ALL=C /opt/perl/bleadperl/bin/perl5.11.0 -e 'eval { $::{"@"}="" }'
% perl -e 'goto("\010"x0x11)."Just another Perl hacker,"'
Just another Perl hacker, at -e line 1.
% perl -e 'goto qq.\010.x0x11.q.Just another Perl hacker,.'
Just another Perl hacker, at -e line 1.
% perl -e 'goto qq.\010.x0x11.qq.Just another Perl hacker,\n.'
Just another Perl hacker,
@haoess
haoess / mysql_table_size.sql
Created November 2, 2010 08:52
List out one database, and each tables size in detail
SELECT table_name, table_rows, data_length, index_length,
round(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = "schema_name";
-- thanks to http://www.mkyong.com/mysql/how-to-calculate-the-mysql-database-size/
#!/bin/bash
xmlstarlet sel -N tei="http://www.tei-c.org/ns/1.0" -t -f -o " " -m "//tei:bibl[@type='source']/tei:title" -c "." -n pj10*/*Z.xml | perl -0777 -nE 's/xmlns="[^"]+"//g;s/\.\.\/database\/journals\/journals. xml/\&journals;/g;s/\s{2,}/ /g;s/([^>])\n/\1/g;s/xml\s/xml\n/g;s/\s(pj\d{3})/\n\1/g;print "$_\n"' | grep '\(pj\|jour"\)' | perl -nE 'chomp;if(/^pj/){$v=$_}else{$v{$v}++}; END { printf "%s: %d\n", $_, $v{$_} for sort { $v{$a} cmp $v{$b} } keys %v}'
@haoess
haoess / gist:786053
Created January 19, 2011 11:47
Alle XML-Elemente aus dem Dingler
ab
abbr
add
addName
author
back
bibl
biblScope
biblStruct
birth
@haoess
haoess / gist:789552
Created January 21, 2011 11:23
XML-Elemente aus dem Dingler, die *nicht* bei der Nurtext-Fassung durch Leerraum abgetrennt werden dürfen
bibl
abbr
biblFull
biblScope
biblStruct
char
charDecl
charName
charProp
choice
@haoess
haoess / gist:799281
Created January 27, 2011 21:12
Häufigkeiten der vergebenen Journal-IDs (sortiert)
perl -nE '/&journals;#(jour\d{4})/ && $j{$1}++; END { printf "%s: %d\n", $_, $j{$_} for sort { $j{$a}<=> $j{$b} } keys %j }' */*Z.xml