Skip to content

Instantly share code, notes, and snippets.

@hernan604
hernan604 / gist:7752683
Last active December 30, 2015 00:58
contar e ordenar palavras em um texto
use strict;
use warnings;
my $text = <<TEXT;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vehicula sodales est vel tempor. Nunc sit amet vulputate quam. Pellentesque porta dictum magna non bibendum. Aliquam consequat fermentum ante, in pulvinar mauris rhoncus nec. Aliquam consectetur ante sed lectus dapibus, quis tincidunt sapien feugiat. Nulla velit urna, lobortis vel sapien ut, ultrices accumsan diam. Phasellus id tellus sed mi tincidunt faucibus. Morbi adipiscing ipsum non feugiat euismod.
Nunc sed dapibus risus. Cras lacus metus, tristique eu tempor ut, ultricies sollicitudin mi. Morbi in ultricies nunc, eu consectetur nulla. Ut non scelerisque libero. Donec vitae feugiat risus. Etiam ut ligula vel lectus tincidunt adipiscing et et turpis. Phasellus sollicitudin a nibh tempor posuere. Curabitur nulla tortor, vulputate vel justo a, viverra fringilla magna. Aenean blandit felis a risus viverra, id bibendum nulla vulputate. Morbi ut volutpat mauris, ut eleifend ligula. Suspendisse sceleris
@hernan604
hernan604 / gist:7797742
Last active December 30, 2015 07:39
js call and apply examples
var pessoas = [
{
"nome" : "João",
"sobrenome" : "Silva"
},
{
"nome" : "Mary",
"sobrenome" : "Mafra"
},
];
#ABSTRACT: Calculates the longest palindrome in perl on a given text
use strict;
use warnings;
my $text = <<TXT;
pdsaj dspa jpdsaa sadsasd dsasad asd sajpod soja ospda opds osadpojsapjodsjpoasd pojasdjp odsaposadpojasdpoasdasd pjkoasd pjoasd pjoasd asd asd pojasd pojasd po aspodasd
dsaok jsdadas s a sads sadds dp wqej wfiwe
odsa sdasd dsasadsaadsasd pofwejp fpw pewf ew
kodas dsasda sad sa as sa asdads as asa sdasd
kosad a sada ssaaasd as adsasd asd asd asaaa a
@hernan604
hernan604 / gist:8460049
Created January 16, 2014 18:02
Js module example with apply
var MeuModulo = MeuModulo || ( function () {
"use strict";
this.init = function ( ) {
}
this.config = undefined;
this.twitter_nivel2 = false;
this.set_config = function ( config ) {
this.config = config;
}
@hernan604
hernan604 / gist:8466937
Last active January 3, 2016 12:59
Exemplos basicos de HTML::TreeBuilder::LibXML e HTML::TreeBuilder::XPath
EXEMPLO_1_HTML_TREEBUILDER_XPATH: {
use strict;
use warnings;
use HTML::TreeBuilder::XPath;
my $tree = HTML::TreeBuilder::XPath->new;
$tree->parse( <<'HTML' );
<!doctype html>
<html>
<body>
@hernan604
hernan604 / gist:8549003
Created January 21, 2014 21:43
creating javascrpt lib example with apply
var Sharer = Sharer || (function () {
"use strict";
this.version = 0.01;
this.config = undefined;
this.set_config = function ( config ) {
this.config = config;
}
this.init = function () {
console.log( "init" );
@hernan604
hernan604 / gist:9055045
Created February 17, 2014 17:25
Nice UN-Common UNIX commands
FROM: http://www.danielmiessler.com/blog/collection-of-less-commonly-used-unix-commands
Collection of Less Commonly Used UNIX Commands
September 11th, 2013 | Linux | System Administration | Technology
[ Check out my latest post on the HP Security Blog: “The Secure Web Series, Part 1: Securing The Password Reset Mechanism” ]
unixcommands
Over at Hacker News there are often threads about less-traveled UNIX commands. One particular comment collected a few of the posts, and I decided to parse all of those threads’ commands, plus my own favorite list of obscure entries, and put them in one place.
@hernan604
hernan604 / gist:9515882
Created March 12, 2014 20:44
convert image to base64 with perl
perl -e 'use MIME::Base64 qw|encode_base64| ; use File::Slurp ; print encode_base64( read_file( $ARGV[0] ) )' /home/hernan/Downloads/quadrado_inclinado.png
@hernan604
hernan604 / gist:9700971
Created March 22, 2014 04:13
example of perl ssh automation adduser with net::ssh2::expect.
#!/usr/bin/perl
use strict;
use warnings;
use Net::SSH2;
use Net::SSH2::Expect;
use DDP;
use strict;
use warnings;
#working example on a ubuntu 12.04.4
@hernan604
hernan604 / gist:9700999
Last active August 29, 2015 13:57
example of perl ssh automation adduser with net::ssh2::expect.
#!/usr/bin/perl
use strict;
use warnings;
use Net::SSH2;
use Net::SSH2::Expect;
use DDP;
use strict;
use warnings;
#working example on a ubuntu 12.04.4