Skip to content

Instantly share code, notes, and snippets.

View dnmfarrell's full-sized avatar

David Farrell dnmfarrell

View GitHub Profile
@dnmfarrell
dnmfarrell / lox debug.txt
Created July 14, 2020 18:46
lox debug mode example
$ ./lox -d
Welcome to Lox version 0.01
> var a = 7; print (a + 4);
1 1 VAR var
1 5 IDENTIFIER a
1 7 EQUAL =
1 9 NUMBER 7
1 10 SEMICOLON ;
1 12 PRINT print
1 18 LEFT_PAREN (
@dnmfarrell
dnmfarrell / dump-catalyst-routes
Last active January 31, 2024 05:47
Prints all controllers, methods and routes for a given Catalyst app
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use Encode 'decode_utf8';
my $app = shift or usage();
bootstrap_app($app, @ARGV);
my $d = $app->dispatcher;
my $actions = get_actions($d);
@dnmfarrell
dnmfarrell / spider.pl
Created January 14, 2019 01:15
Basic Perl spider using Selenium and headless Chrome
#!/usr/bin/env perl
use strict;
use warnings;
use HTTP::Tiny;
use Getopt::Long 'GetOptions';
use Encode qw(encode decode);
use Parallel::ForkManager;
use PerlIO::gzip;
use Selenium::Remote::Driver;
use Time::HiRes 'sleep';
// OpenGL Extension Exclusions - may be modified before building.
//
// Generated for Intel Open Source Technology Center, Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2)
// OpenGL v3.0 Mesa 11.1.0 (git-525f3c2), using FreeGLUT v30000
#define NO_GL_VERSION_4_5
#define NO_GL_VERSION_4_4
#define NO_GL_VERSION_4_3
#define NO_GL_VERSION_4_2
#define NO_GL_VERSION_4_1
@dnmfarrell
dnmfarrell / build.log
Created June 17, 2016 17:49
cpanm MITHALDU/OpenGL-0.6704_05.tar.gz
cpanm (App::cpanminus) 1.7039 on perl 5.022000 built for x86_64-linux
Work directory is /home/dfarrell/.cpanm/work/1466185583.22703
You have make /usr/bin/make
You have LWP 6.15
You have /usr/bin/tar: tar (GNU tar) 1.28
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@dnmfarrell
dnmfarrell / list-modules
Created March 10, 2016 17:32
Perl script to list all *pm files under a directory
#!/usr/bin/env perl
use 5.10.3;
use Path::Tiny 'path';
use Getopt::Long 'GetOptions';
GetOptions(
'dir=s' => \my $dirpath,
) or die "Unrecognized option\n";
die "--dir is required\n" unless $dirpath && -d $dirpath;
~/bugzilla-5.0.2 grep -rF ' WHERE ' Bugzilla
Bugzilla/Memcached.pm: $dbh->do("UPDATE profiles SET request_count=10 WHERE login_name=?", undef, $login);
Bugzilla/Memcached.pm: $dbh->do("UPDATE profiles SET last_activity_ts=? WHERE userid=?",
Bugzilla/Search.pm:# SELECT blah FROM blah WHERE ( (a1 OR a2)AND(b1 OR b2 OR b3)AND(c1)) AND (d1)
Bugzilla/Search.pm: WHERE $where
Bugzilla/Search.pm:# Internal Accessors: WHERE #
Bugzilla/Search.pm:# Note: There's also quite a bit of stuff that affects the WHERE clause
Bugzilla/Search.pm:# The terms that are always in the WHERE clause. These implement bug
Bugzilla/Search.pm:        return "$outer $not IN (SELECT DISTINCT $inner FROM $table WHERE $cond)";

An Introduction to tmux

Overview

  • Terminal multiplexer
  • Multiple terminals
  • Panes & windows
  • Maintains connections
  • Configurable
#!/usr/bin/env perl
use strict;
use warnings;
BEGIN { $SIG{INT} = $SIG{TERM} = sub { exit 0 } }
use Getopt::Long;
use Pod::Usage;
GetOptions (
grammar foo
{
token TOP { ^ .* $ }
}
class bar
{
method TOP ($/)
{
say $/;