Skip to content

Instantly share code, notes, and snippets.

Avatar

Bradley Dean bjdean

View GitHub Profile
View pycon2020-RubeCodeberg-2.py
#!/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 Sep 6, 2020
Submission to the PyConlineAU2020 Rube Codeberg competition
View pyconau2020-RubeCodeberg.py
#!/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 Dec 18, 2015
quick filter of apache logs to show specific fields
View filter_apache_log.pl
#!/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 / goroutinesOnExit.go
Created Jun 6, 2013
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 …
View goroutinesOnExit.go
/*
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)
@bjdean
bjdean / cmdfile.go
Created Jun 6, 2013
Nagios2 command file updates with Go
View cmdfile.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 / goDocTests.go
Created Jun 6, 2013
thinking about how godoc handles go public/private code
View goDocTests.go
/*
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 Dec 18, 2015
Google Go - Playing around with JSON
View good.json
{
"a" : "a is for apple",
"b" : ["b", "is", "a", "list"],
"c" : {
"d" : "dog",
"e" : "elephant",
"f" : "frog"
}
}