Skip to content

Instantly share code, notes, and snippets.

View techdragon's full-sized avatar

Samuel Bishop techdragon

View GitHub Profile
@techdragon
techdragon / game-setting(source).js
Last active January 23, 2020 14:34
Ember Sourcemap Help?
import {Model, attr, hasMany} from '@ember-data/model';
export default class GameSystemModel extends Model {
@attr('string') name;
@hasMany('game-setting') gameSetting;
@hasMany('genesys-character') characters;
}
@techdragon
techdragon / gist:2a25a04213cd7c032fe2
Created February 8, 2016 07:32 — forked from heywbj/gist:da10d99f66df6361db9f
Get Elastic beanstalk environment information
import boto.utils
import boto.beanstalk
good_statuses = ('Launching', 'Updating', 'Ready')
def get_eb_environment_description():
identity_document = boto.utils.get_instance_identity()['document']
connection = boto.beanstalk.connect_to_region(identity_document['region'])
envs = (e for e in
@techdragon
techdragon / COPYING.rst
Last active September 20, 2015 13:53 — forked from jedsmith/COPYING.rst
The Apache License, v2.0, formatted as reStructuredText.

Apache License

Version

2.0

Date

January 2004

URL

http://www.apache.org/licenses/

------------------------------------------------------------TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

@techdragon
techdragon / test.py
Created November 4, 2014 08:05
possible bug in python 3.4
>>> class Foo:
... class Bar(object):
... keywords = dict()
... def __init__(self, **kwargs):
... print(dir(__class__))
... print(__class__.__qualname__)
... self.keywords = kwargs
...
>>> test = Foo.Bar(baz='boom')
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'keywords']
class LimitedDict(dict):
"""
Sub Class of the dictionary object that restricts the allowed keys.
The allowed keys are set when creating the object.
"""
_allowed_keys = list()
def __init__(self, allowed_keys, **kwargs):
if not isinstance(allowed_keys, list):
AttributeError("'allowed_keys' must be a list")
self._allowed_keys = allowed_keys
@techdragon
techdragon / build_packages.log
Created October 27, 2014 03:30
cores build log
techdragon@server ~/trunk/src/scripts $ ./build_packages
INFO update_chroot: Setting up portage...
INFO update_chroot: Setting up crossdev...
INFO update_chroot: Updating chroot:
INFO update_chroot: chroot version: 475.1.0+2014-10-27-1108
INFO update_chroot: CoreOS version: 475.1.0+2014-10-27-1112
INFO update_chroot: Updating basic system packages
!!! Error fetching binhost package info from 'http://builds.developer.core-os.net/sdk/amd64/475.1.0/pkgs/'
@techdragon
techdragon / gist:7091855158aa9d797ee2
Last active August 29, 2015 14:07
docker strafe results
root@testing:~# strace docker -d
execve("/usr/bin/docker", ["docker", "-d"], [/* 19 vars */]) = 0
uname({sys="Linux", node="testing", ...}) = 0
brk(0) = 0x1fe7000
brk(0x1fe81c0) = 0x1fe81c0
arch_prctl(ARCH_SET_FS, 0x1fe7880) = 0
set_tid_address(0x1fe7b50) = 2293
set_robust_list(0x1fe7b60, 24) = 0
futex(0x7fff372aed40, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 1fe7880) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGRTMIN, {0x8f8d40, [], SA_RESTORER|SA_SIGINFO, 0x8f9400}, NULL, 8) = 0
@techdragon
techdragon / models.py
Created March 6, 2014 05:15
Is there a better way to do this in Django? Does this warrant being a new relation type instead of living as a model ?
from django import models
class Item(models.Model):
"""Items go in boxes, there can be multiple instances of the same
item in a box"""
class Meta:
verbose_name = _('Item')
verbose_name_plural = _('Items')
title = models.CharField(max_length=50, blank=True, null=True, default='')
input {
file {
path => "/var/log/app/app_servicediscovery.log"
type => "servicediscovery"
}
}
filter {
multiline {
@techdragon
techdragon / x11colours.css
Created February 16, 2014 08:38
The x11 color set as a css file.
.text-colour-lavender { color: #E6E6FA; }
.text-colour-thistle { color: #D8BFD8; }
.text-colour-plum { color: #DDA0DD; }
.text-colour-violet { color: #EE82EE; }
.text-colour-orchid { color: #DA70D6; }
.text-colour-fuchsia { color: #FF00FF; }
.text-colour-magenta { color: #FF00FF; }
.text-colour-mediumorchid { color: #BA55D3; }
.text-colour-mediumpurple { color: #9370DB; }
.text-colour-blueviolet { color: #8A2BE2; }