Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import sys
import re
class Node:
def __init__ (self, value):
self.value = value
self.next = None
#!/usr/bin/env python
''' example of a visitor pattern '''
import os
def printer (dir, file):
print(dir + os.path.sep + file)
def vwalk (path, visit):
@jgrar
jgrar / example.pl
Created April 14, 2018 06:50
Hash ref prototype issue passing between subs
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use diagnostics;
use Data::Dumper;
sub takeshash (\%) {
@jgrar
jgrar / rps.pl
Last active April 3, 2018 02:37
Rock paper scissors game
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use constant SYM => qw(rock scissors paper);
my $msg = "Enter 0 for rock, 1 for scissors, 2 for paper, or enter 'quit' to exit\n";
@jgrar
jgrar / main.pl
Created March 24, 2018 04:55
Corrected week 6 basic OOP example
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin qw($RealBin);
use lib $RealBin;
use trivial;
my $obj1 = new trivial;
@jgrar
jgrar / tutorial2-q2.pl
Created March 7, 2018 01:38
Answer to Scripting Programming tutorial 2, question 2
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
=pod
=head1 Tutorial 2: Question 2
@jgrar
jgrar / dwm-3465bed290ab-save_floats.diff
Created December 31, 2015 02:55
Add save float behaviour to all layout changes
diff --git a/dwm.c b/dwm.c
index 450e420..7978a1f 100644
--- a/dwm.c
+++ b/dwm.c
@@ -89,6 +89,7 @@ struct Client {
char name[256];
float mina, maxa;
int x, y, w, h;
+ int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
int oldx, oldy, oldw, oldh;
@jgrar
jgrar / dwm-3465bed290ab-runorraise.diff
Last active December 30, 2015 17:39
add support for better window hint matching
diff --git a/runorraise.c b/runorraise.c
new file mode 100644
index 0000000..5494aaa
--- /dev/null
+++ b/runorraise.c
@@ -0,0 +1,52 @@
+typedef struct {
+ char *class;
+ char *name;
+ char *spawncmd[];
@jgrar
jgrar / dwm-3465bed290ab-maximize_vert_horz.diff
Created December 30, 2015 00:51
add window rule to dwm maximise patch
diff --git a/config.def.h b/config.def.h
index 7054c06..859bdcf 100644
--- a/config.def.h
+++ b/config.def.h
@@ -24,9 +24,9 @@ static const Rule rules[] = {
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
- /* class instance title tags mask isfloating monitor */
- { "Gimp", NULL, NULL, 0, 1, -1 },
@jgrar
jgrar / dwm-6.1-statuscolors-r2.diff
Created December 22, 2015 18:06
modified dwm-6-1-statuscolors patch
diff --git a/config.h b/config.h
index 7054c06..9199a1f 100644
--- a/config.h
+++ b/config.h
@@ -5,12 +5,13 @@ static const char *fonts[] = {
"monospace:size=10"
};
static const char dmenufont[] = "monospace:size=10";
-static const char normbordercolor[] = "#444444";
-static const char normbgcolor[] = "#222222";