Skip to content

Instantly share code, notes, and snippets.

Open Development Network opendevnet

  • Ottawa, Canada
Block or report user

Report or block opendevnet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View FP_sigs_attributes.pl
package Surfz ;
use Function::Parameters ;
use base 'Sub::Attributes';
fun new :ClassMethod {
my $class = shift;
my $self = {};
bless $self, $class;
return $self;
View hangperson_game.rb
class HangpersonGame
def initialize(word)
@word = word
@guesses = ""
@wrong_guesses = ""
end
attr_accessor :word, :guesses, :wrong_guesses
View functions_sub_example.p6
sub escape ($str) {
# Puts a slash before non-alphanumeric characters
S:g[<-alpha -digit>] = "\\$/" given $str
}
say escape 'foo#bar?'; # foo\#bar\?
{
sub escape ($str) {
# Writes each non-alphanumeric character in its hexadecimal escape
View Pegex-inline-parse.pl
#!/usr/bin/env perl
use v5.22;
use experimental qw/ refaliasing postderef / ;
use Pegex;
my $data = do { local $/; <DATA> } ;
my $grammar = q[
%grammar thing
%version 0.0.1
@opendevnet
opendevnet / ip2country.pl
Last active Dec 17, 2015
Find country of origin for systems wanting access to your shell accounts.
View ip2country.pl
#!/usr/bin/env perl
use 5.14.0 ;
use Geo::IP::PurePerl;
use autodie ;
my $gi = Geo::IP::PurePerl->new(GEOIP_STANDARD);
# /tmp/ips.txt is created from firewall
# rules and/or /var/log/auth.log with e.g.
View Oneliners.txt
# Converting to both perl5 and perl6 to see differences and similarities.
# Note that if you have a perl > 5.14.* the -E switch enables
# say, unicode, etc. which makes perl5 a bit more like perl6
# for oneliners anyway. Is using the -p switch cheating?
#------------------------------------------------------------
# 1. Print the third column of the line in a file.
# a.
perl6 -n -e '.split(" ")[2].say' file.txt
You can’t perform that action at this time.