Skip to content

Instantly share code, notes, and snippets.

View andrewsolomon's full-sized avatar

Andrew Solomon andrewsolomon

View GitHub Profile
@andrewsolomon
andrewsolomon / hello.pl
Created April 27, 2014 17:02
Hello Geekuni Community!
#!/usr/bin/perl
use strict;
use warnings;
use feature 'say';
say 'Hello Geekuni Community!';
@andrewsolomon
andrewsolomon / data-rmap-example
Created July 20, 2014 10:04
Data::Rmap - Example 1
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use Data::Rmap ':all';
my $rh_config = {
convoluted => [
'configuration',
@andrewsolomon
andrewsolomon / 002_index_route.t
Created October 25, 2014 21:50
Dancer2 0.153 Unit testing example
#!/usr/bin/perl
use Test::More tests => 2;
use strict;
use warnings;
use Plack::Test;
use HTTP::Request::Common;
use GuArt::Controller;
@andrewsolomon
andrewsolomon / boolean_eq_timing.pl
Created February 1, 2015 15:59
Speed of Boolean equality operators
#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes;
my @tfs = map { $_ % 2 } (1 .. 10000);
# Just warming up the arrays
my $z;
foreach my $x (@tfs) {
@andrewsolomon
andrewsolomon / typeglob.pl
Created August 30, 2015 21:00
Typeglob example
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use Data::Dump 'pp';
# Typeglob example - only works with dynamic (our) variables
# see http://perldoc.perl.org/perlmod.html#Symbol-Tables
@andrewsolomon
andrewsolomon / game.pl
Created October 14, 2015 13:51
The Perl references game
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use Data::Dumper;
my $big_bird = 500;
# 1
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use Data::Dump 'pp';
# http://stackoverflow.com/questions/372370/how-can-i-split-a-string-into-chunks-of-two-characters-each-in-perl
ubuntu@ip-172-30-1-155:~/git/ebox-factory$ rex -d shellinabox
[2016-05-02 11:18:37] DEBUG - This is Rex version: 1.4.0
[2016-05-02 11:18:37] DEBUG - Command Line Parameters
[2016-05-02 11:18:37] DEBUG - d = 1
[2016-05-02 11:18:37] DEBUG - Creating lock-file (Rexfile.lock)
[2016-05-02 11:18:37] DEBUG - Loading Rexfile
[2016-05-02 11:18:37] DEBUG - Enabling task_chaining_cmdline_args feature
[2016-05-02 11:18:37] DEBUG - Activating new template engine.
[2016-05-02 11:18:37] DEBUG - Disabling usage of a tty
[2016-05-02 11:18:37] DEBUG - Activating autodie.
task "shellinabox", group => "ebox", sub {
say "UPTO 1";
file "/tmp/shellinabox.deb",
source => "deb/shellinabox_2.19_amd64.deb";
say "UPTO 2";
sudo sub {
ubuntu@ip-172-30-1-155:~$ sudo apt-get remove shellinabox
sudo: unable to resolve host ip-172-30-1-155
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
shellinabox
0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded.
After this operation, 552 kB disk space will be freed.
Do you want to continue? [Y/n] Y