Skip to content

Instantly share code, notes, and snippets.

View freakboy3742's full-sized avatar

Russell Keith-Magee freakboy3742

View GitHub Profile
@freakboy3742
freakboy3742 / gist:8493564
Created January 18, 2014 17:29
E126 brain death.
pep8_compliant = MyObject(
"this is quite a long string that is"
"going to go on for quite a while",
"but it's a different string to this one."
)
sane = MyObject(
"this is quite a long string that is"
"going to go on for quite a while",
"but it's a different string to this one."
@freakboy3742
freakboy3742 / keybase.md
Created March 7, 2014 08:10
Keybase verification

Keybase proof

I hereby claim:

  • I am freakboy3742 on github.
  • I am freakboy3742 (https://keybase.io/freakboy3742) on keybase.
  • I have a public key whose fingerprint is CBE7 4366 F6CA 0A0D 4BA7 D2F8 3D2D AB6A 37BB 5BC3

To claim this, I am signing this object:

@freakboy3742
freakboy3742 / cricket.py
Created March 28, 2015 01:01
Sample tree-using Toga project.
#!/usr/bin/env python
from __future__ import print_function, unicode_literals, absolute_import
import toga
if __name__ == '__main__':
def build(app):
main_container = toga.Container()
@freakboy3742
freakboy3742 / gist:c699f293c9b5e77ef289
Last active December 26, 2022 00:32
Douglas Adams on jokes

From: Salmon of Doubt by Douglas Adams

There’s always a moment when you start to fall out of love, whether it’s with a person or an idea or a cause, even if it’s one you only narrate to yourself years after the event: a tiny thing, a wrong word, a false note, which means that things can never be quite the same again. For me it was hearing a stand-up comedian make the following observation: “These scientists, eh? They’re so stupid! You know those black-box flight recorders they put on aeroplanes? And you know they’re meant to be indestructible?

It’s always the thing that doesn’t get smashed? So why don’t they make the planes out of the same stuff?” The audience roared with laughter at how stupid scientists were, couldn’t think their way out of a paper bag, but I sat feeling uncomfortable. Was I just being pedantic to feel that the joke didn’t really work because flight recorders are made out of titanium and that if you made planes out of titanium rather than aluminium, they’d be far too heavy to get off the

@freakboy3742
freakboy3742 / django-mailer.patch
Created September 8, 2015 19:31
Patch to get django-mailer working
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py
index d8f7fe5..7a7c651 100644
--- a/django/contrib/admin/checks.py
+++ b/django/contrib/admin/checks.py
@@ -560,9 +560,10 @@ class ModelAdminChecks(BaseModelAdminChecks):
id='admin.E105',
)
]
- elif not issubclass(inline.model, models.Model):
- return must_be('a Model', option='%s.model' % inline_label,
@freakboy3742
freakboy3742 / Bag suggestions
Last active October 5, 2015 08:22
Suggestions for laptop bags
Recommended:
Booq http://www.booqbags.com/us/backpacks
Tom Bihn http://www.tombihn.com/laptop-bags/TB0111.html
LL Bean http://global.llbean.com/shop/Ridge-Runner-25-Day-Pack/88843.html
Targus
Timbuk2
Thule http://www.thule.com.au/details.php?p_id=854&listid=36&slistid=&seo=(New)_TCBP-417____32_Litre_Laptop_Backpack
Everki http://www.everki.com
Found; looks interesting:
@freakboy3742
freakboy3742 / Myobject.py
Created December 11, 2015 00:38
Python 3 class definitions for fun and profit
class JavaClass:
# Details go here
pass
class JavaInterface:
# Details go here
pass
@freakboy3742
freakboy3742 / Metaclass.py
Created December 11, 2015 00:50
Py3 Metaclasses for fun and profit
class JavaClass:
# Details go here
pass
class JavaInterface:
# Details go here
pass
@freakboy3742
freakboy3742 / example.py
Created December 11, 2015 12:14
Another VOC milestone
class MyStringAnalog(implements=java.lang.CharSequence):
def __init__(self, value):
self.value = value
def charAt(self, index: int) -> char:
return 'x'
def length(self) -> int:
return len(self.value)
@freakboy3742
freakboy3742 / Object.java
Created December 17, 2015 11:04
Why I like Python, volume 3742
package org.python.java;
public class Object extends org.python.types.Object {
static
// public static org.python.Object convert(java.lang.Object java) {
// if (java instanceof java.lang.String) {
// return new org.python.types.Str((java.lang.String) java);
// } else {
// return new org.python.java.Object(java);