Skip to content

Instantly share code, notes, and snippets.

View olliebun's full-sized avatar
⌨️
IC

Oliver Hassett olliebun

⌨️
IC
View GitHub Profile
@olliebun
olliebun / snmpd.conf
Created May 1, 2014 04:42
Added `sleep` to the end of the `stop)` part of snmpd's init script.
--- snmpd-old 2014-05-01 04:39:55.730977212 +0000
+++ snmpd-new 2014-05-01 04:39:49.826876451 +0000
@@ -63,10 +63,11 @@
log_daemon_msg "Stopping network management services:"
start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
log_progress_msg " snmpd"
start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmptrapd && [ ! -f $TRAPD_PID ] || rm $TRAPD_PID
log_progress_msg " snmptrapd"
+ sleep 2
;;
@olliebun
olliebun / gist:8647493
Last active January 4, 2016 16:29
mutt deficiencies - some idle thoughts

Deficiencies with mutt:

  • sending is either synchronous or basically throwaway - I have to remember to check syslog to see whether my message was sent??
  • mbox and maildir suck
  • doesn't seem to have a plugin system really - extensions are compiled in?
  • flexibility has a cost - a single back-end and a single protocol set (e.g. always TLS, IMAP and SMTP) could cover most cases and simplify substantially
  • difficult to have secure storage
@olliebun
olliebun / gist:8295224
Last active March 22, 2020 12:27
LCA2014 Astronomy Miniconf lightning talk notes

boinc - Berkeley Open Infrastructure for Network Computing

Even armV6 / armV7 systems with a single core can contribute significantly.

Run boinc persistently on a Pi / whatever without affecting latency of other service.

boinc is in both Raspbian and Arch Linux.

Install boinc:

@olliebun
olliebun / gist:7997229
Created December 16, 2013 23:46
the zen of python
[10:46] foa:~ $ python
Python 2.7.6 (default, Dec 16 2013, 12:56:10)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
@olliebun
olliebun / gist:7798493
Created December 5, 2013 01:04
C OID handling in Go
type OID []uint32
// Create a new OID
func NewOID(num ...uint32) OID {
return num
}
// Create an OID from the C representation
func NewOIDFromCArray(coid *C.oid, oid_length C.int) (OID, error) {
// See http://stackoverflow.com/questions/14826319/go-cgo-how-do-you-use-a-c-array-passed-as-a-pointer
@olliebun
olliebun / gist:7650947
Created November 25, 2013 23:46
Error when bootstrapping Go for Linux X86-64 cross-compilation on OSX Mavericks
$ hg summary
parent: 16840:414057ac1f1f go1.1.2 release
go1.1.2
branch: release-branch.go1.1
commit: (clean)
update: (current)
$ clang -v
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
@olliebun
olliebun / gist:7295983
Created November 3, 2013 23:22
Coffeecript's list comprehension compilation.. crazy.
validate: (attrs, options) ->
missing = [attr for attr in required if attrs[attr] is null]
if missing.length > 0
return "Missing #{missing.join(', ')}"
@olliebun
olliebun / test.php
Last active December 23, 2015 12:09
Getting the path to a PHP file without resolving symlinks.
$ ln -s test.php foo.php
$ php test.php
/home/vagrant/test.php
$ php foo.php
/home/vagrant/foo.php
@olliebun
olliebun / gist:6489507
Last active December 22, 2015 14:59
love #dat settler state
for the next time a technocrat faffs on about how everything would be ok If People Just Respected Statistics And Data:
Through the state's statistical fetishism, a de-contextualised and dated
statistic derived from vague sources comes to represent reality. Zombie-like,
this statisic rises from the grave, consuming hunters, fishers and gatherers
and their bush foods along with entire outstations so that they can no longer
be seen by the state. Fetishised, it gains a magical power over other evidence
that either challenges or contextualises it. It also gains a power over
Indigenous communities, as this statistical abstraction becomes a means for
creting their reality rather than merely representing it. It is used as
@olliebun
olliebun / gist:5996606
Created July 14, 2013 23:47
Get exception line number
import sys
try:
raise ValueError("Damn")
except ValueError as e:
_, _, exc_tb = sys.exc_info()
# print the file that threw the exception
print(exc_tb.tb_frame.f_code.co_filename)
# print the line number of the expression that threw the exception
print(exc_tb.tb_lineno)