Skip to content

Instantly share code, notes, and snippets.

View mishin's full-sized avatar
💭
if you fail to prepare you prepare to fail

Nikolay Mishin mishin

💭
if you fail to prepare you prepare to fail
View GitHub Profile
use strict;
use warnings;
use 5.010;
use Path::Iterator::Rule;
use File::Slurp;
die "Usage: $0 DIRs" if not @ARGV;
my $rule = Path::Iterator::Rule->new;
use strict;
use warnings;
use 5.010;
use Path::Iterator::Rule;
use File::Slurp;
die "Usage: $0 DIRs" if not @ARGV;
my $rule = Path::Iterator::Rule->new;
function substitute {
if [ -z "$1" -o -z "$2" ]; then
echo "Usage: substitue FROM_STRING TO_STRING [OPTION]..."
echo
echo "Replace all occurances of FROM_STRING (a sed-compatible regular"
echo "expression) with TO_STRING in all files for which ack-grep matches"
echo "FROM_STRING."
echo
echo "Any additional options are passed directly to ack-grep (e.g.,"
echo " --type=html would only run the substitution on html files)."
#!/bin/sh
# This file was generated by the xmeta commons-launcher maven plugin.
# Do not edit this file directly.
myPath=`dirname $0`
case `uname` in
CYGWIN*) # cygwin-specific stuff here
myPath=`cygpath -w "$myPath"`
;;
esac
@mishin
mishin / find_pod.pl
Last active August 29, 2015 14:23
find pod files and list it in the order of count these lines
use strict;
use warnings;
use 5.010;
use Carp;
use English qw(-no_match_vars);
use FindBin '$RealBin';
use Log::Log4perl qw(:easy);
use open qw/:std :utf8/;
use Path::Iterator::Rule;
@mishin
mishin / gen_pdf
Last active August 29, 2015 14:23 — forked from barefootcoder/gen_pdf
#! /bin/bash
# To make this work, you will need Vroom 0.28 or later. Slide notes are optional, but
# recommended. Slide titles won't be used for this application.
#
# Earlier versions of Vroom will work if you add the dashes in front of the vroom commands
# (e.g. `vroom -compile` and `vroom -html`). But the HTML is formatted a bit differently, so
# I make no promises that it will come out looking as good as the newest versions.
# You'll also need wkhtmltopdf. If you don't have it, you can get it here:
#!/usr/bin/env perl
use 5.016;
use common::sense;
use utf8::all;
# Use fast binary libraries
use EV;
use Web::Scraper::LibXML;
use YADA 0.039;
use v6;
=begin pod
=TITLE Get list of files matching a pattern
=AUTHOR stmuk
You want a list of filenames matching a pattern
=end pod
sub MAIN(:$dir = ".") {
my @perl-files = dir $dir, test => /\.pl/;
@mishin
mishin / debug.pl
Created September 2, 2015 14:19
my debugger
use FindBin '$RealBin';
use Log::Log4perl qw(:easy);
my $log_file = $RealBin . "/show_image.log";
#Init logging
Log::Log4perl->easy_init(
{ level => $DEBUG,
file => ":utf8>>$log_file",
layout => '%d %p> %m%n'
}
@mishin
mishin / yapcna2015.wq.pl
Created September 24, 2015 10:59 — forked from jacoby/yapcna2015.wq.pl
Head to head comparison of Mojo::DOM and Web::Query
#!/usr/bin/env perl
use feature qw{ say state unicode_eval unicode_strings } ;
use strict ;
use warnings ;
use utf8 ;
use Data::Dumper ;
use Mojo::DOM ;
use Web::Query ;