Skip to content

Instantly share code, notes, and snippets.

View bjdean's full-sized avatar

Bradley Dean bjdean

View GitHub Profile
#!/usr/bin/env python3
# A slightly animated cute (but after the deadline version) of pycon2020-RubeCodeberg.py
from bs4 import BeautifulSoup
import sys
import time
def decl(l): print(l, end=''); sys.stdout.flush(); time.sleep(0.1); return lambda f: f
@decl('H')
@decl('e')
@decl('l')
@bjdean
bjdean / pyconau2020-RubeCodeberg.py
Last active September 6, 2020 01:38
Submission to the PyConlineAU2020 Rube Codeberg competition
#!/usr/bin/env python3
from bs4 import BeautifulSoup
def decl(l): return lambda f: lambda: l + f()
def decp(f): return lambda: print(BeautifulSoup(f(),'html.parser').prettify(), end='')
@decp
@decl('H')
@decl('e')
@decl('l')
@decl('l')
@decl('o')
@bjdean
bjdean / filter_apache_log.pl
Last active December 18, 2015 04:39
quick filter of apache logs to show specific fields
#!/usr/bin/perl
# filter_apache_log.pl - quick filter of apache logs to show specific fields
# Copyright (C) 2008 Bradley Dean <bjdean@bjdean.id.au>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
@bjdean
bjdean / goDocTests.go
Created June 6, 2013 09:48
thinking about how godoc handles go public/private code
/*
Playing around with how docs are genrated
// Indented comments are block-quoted like code#
foo := make(Bar, 10)
*/
package randomDocs
/*
@bjdean
bjdean / good.json
Last active December 18, 2015 03:48
Google Go - Playing around with JSON
{
"a" : "a is for apple",
"b" : ["b", "is", "a", "list"],
"c" : {
"d" : "dog",
"e" : "elephant",
"f" : "frog"
}
}
@bjdean
bjdean / cmdfile.go
Created June 6, 2013 09:50
Nagios2 command file updates with Go
package nagios2
/*********************************************************************
* Nagios2 Command File access
*
* Copyright 2013 Bradley Dean
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@bjdean
bjdean / goroutinesOnExit.go
Created June 6, 2013 09:56
What happens to the goroutines? On exit (once main goes away, or if os.Exit is called) the goroutines are killed off (no deferred functions are run). Note - to get goroutines to quit a 'broadcast' quit channel can be created - as a closed channel starts to return which means a global quit channel can be included in all selects in goroutines and …
/*
What happens to the goroutines?
On exit (once main goes away, or if os.Exit is called) the goroutines
are killed off (no deferred functions are run).
Note - to get goroutines to quit a 'broadcast' quit channel can be
created - as a closed channel starts to return which means a global quit
channel can be included in all selects in goroutines and they'll only
fire when the quit channel is closed (see builting close documentation)