This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
#Mojo::DOM and Mojo::UserAgent just rock, but sometimes you are not allowed to use them. | |
use 5.14.2; | |
use HTML::TreeBuilder; | |
my $url = 'http://contao.org/en/extension-list/view/i18nl10n.html'; | |
my $root = HTML::TreeBuilder->new_from_url($url); | |
$root->eof(); # done parsing for this tree | |
my $h1 = $root->find_by_tag_name('h1'); | |
say $h1->as_trimmed_text; #h1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.14.2; | |
use Benchmark qw(timethese cmpthese); | |
use HTML::TreeBuilder; | |
use Mojo::UserAgent; | |
use Mojo::DOM; | |
my $url = 'http://www.i-can.eu/index.html'; | |
my $content = Mojo::UserAgent->new->get($url)->res->body; | |
#PARSING SPEED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use FindBin; | |
use lib "$FindBin::Bin/../lib/perl5"; | |
use Mojo::Base -strict; | |
use Mojo::DOM; | |
use Mojo::File qw (path); | |
Mojo::Util::getopt \@ARGV, | |
'--input_folder|i=s' => \(my $in_folder = ''), | |
'--output_file|o=s' => \my $out_file, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn largest<T: PartialOrd + Copy>(vec: &Vec<T>) -> T { | |
let mut largest = vec[0]; | |
for e in vec { | |
if e > &largest { | |
largest = *e; | |
} | |
} | |
largest | |
} | |
fn main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojo -strict; | |
use Mojo::File qw(path); | |
# cd to the directory where your files are | |
# and run this program | |
# $0 $format_in $format_out | |
my ($format_in, $format_out) = @ARGV; | |
say qq|Converting from "$format_in" to "$format_out"|; | |
for my $file ( path('./')->list->each ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# My notes - K. Berov: | |
# Copied from | |
# https://gist.githubusercontent.com/zmughal/8264712/raw/8831e421393143c5b48f22dcfa12eeda51c5cfbf/install-imagemagick-perl | |
# and modified for my self. | |
# I already have several perls | |
# I will use 5.26.2 for this installation | |
# See https://www.perl.com/article/57/2014/1/1/Shazam--Use-Image--Magick-with-Perlbrew-in-minutes/ | |
# See mainly the following as this configuration actually worked: | |
# https://github.com/lecstor/DevNotes/wiki/Image-Magick-with-Perlbrew |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# I tried this even wth my system perl because I had installed modules there | |
# For this you need to be root, but beware you can break your system, | |
# if you have important scripts using some of these modules | |
# get list of installed modules via `cpanm` or `cpan` | |
export PERLLOCAL=`find "$1" -name 'perllocal.pod'` | |
# find and uninstall installed modules. cpanm will propt for each one | |
cpanm -U `perl -ne 'print "$1 " if /L\<([^\|]+)\|/' $PERLLOCAL` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/apache2/sites-enabled/001-dev.slovo.conf | |
<VirtualHost *:80> | |
ServerName dev.slovo.bg | |
ServerAdmin webmaster@dev.slovo | |
DocumentRoot /home/berov/opt/dev.slovo.bg | |
<Directory "/home/berov/opt/dev.slovo.bg"> | |
AllowOverride All | |
Require all granted | |
</Directory> |
OlderNewer