Skip to content

Instantly share code, notes, and snippets.

View parse.pl
open F, $opt{src_file} or die "Cannot open file `$opt{src_file}': $!";
my $counter=0;
my $record = "";
while (<F>) {
$counter++, process_record($record), $record = "" if /\d{4}\.\d{2}\.\d{2} \d
$record .= $_;
}
# Process last record
View ips.sh
#!/bin/sh
echo This is Interactive Perl shell
rlwrap -A -pgreen -S"perl> " perl -wnE'say eval()//$@'
View dupfind.sh
#!/bin/sh -e
# SUM is any command that produces following output:
# <sum> <file>
#SUM="md5 -r"
SUM="md5sum"
# F is output file for the list of files found by sumfiles
F=/tmp/dupfind.tmp
FINDPTH="."
View git-large-blob
#!/usr/bin/perl
# As appeared at http://stackoverflow.com/questions/298314/find-files-in-git-repo-over-x-megabytes-that-dont-exist-in-head
use 5.008;
use strict;
use Memoize;
sub usage { die "usage: git-large-blob <size[b|k|m]> [<git-log args ...>]\n" }
@ARGV or usage();
my ( $max_size, $unit ) = ( shift =~ /^(\d+)([bkm]?)\z/ ) ? ( $1, $2 ) : usage();
View expandshell.sh
#!/bin/sh
perl -pe 's/\$(\w+)/$ENV{$1}/g' file.sh
View git-large-blob.pl
#!/usr/bin/perl
# As appeared at http://stackoverflow.com/questions/298314/find-files-in-git-repo-over-x-megabytes-that-dont-exist-in-head
use 5.008;
use strict;
use Memoize;
sub usage { die "usage: git-large-blob <size[b|k|m]> [<git-log args ...>]\n" }
@ARGV or usage();
my ( $max_size, $unit ) = ( shift =~ /^(\d+)([bkm]?)\z/ ) ? ( $1, $2 ) : usage();
View git-find-blob.sh
#!/bin/sh
obj_name="$1"
shift
git log "$@" --pretty=format:'%T %h %s' \
| while read tree commit subject ; do
if git ls-tree -r $tree | grep -q "$obj_name" ; then
echo $commit "$subject"
fi
done
View a.awk
BEGIN {
FS="|";
OFS=";;";
moj="";
oldRT="";
}
{
gsub(/ahoj/, "kvak", $1);
#$1 = gsub(/>\s+/, ">", $1);
#$1 = gsub(/\s+</, "<", $1);
View notes.txt
perl -d -e 1
export ORACLE_HOME=$(find /usr/lib/oracle/ -name client64 | tail -1)
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
grep CATALOG_VERSION_NO src/include/catalog/catversion.h
View p.pl
use warnings;
use Data::Dumper;
sub a { 5 };
%a = (a=>1,'b',2);
@b = ('a'=>1=>'b'=>2);
print Dumper %a;
#print $a{'a'},"\n";
print Dumper @b;
You can’t perform that action at this time.