Skip to content

Instantly share code, notes, and snippets.

Avatar

Douglas Russell dpwrussell

  • MathWorks
  • Cambridge, UK
View GitHub Profile
@dpwrussell
dpwrussell / .gitignore
Last active Nov 30, 2020
FileMaker JDBC From Python
View .gitignore
*.class
*.pyc
fmjdbc.jar
@dpwrussell
dpwrussell / sqlalchemy_subqueryload_poly.py
Last active Aug 15, 2016
SQLAlchemy Subqueryload Poly
View sqlalchemy_subqueryload_poly.py
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (relationship, sessionmaker, subqueryload,
with_polymorphic)
from sqlalchemy import create_engine, Column, String, Integer
from sqlalchemy.schema import ForeignKey
Base = declarative_base()
class A(Base):
View keybase.md

Keybase proof

I hereby claim:

  • I am dpwrussell on github.
  • I am dpwrussell (https://keybase.io/dpwrussell) on keybase.
  • I have a public key whose fingerprint is 6692 35CA 6CD1 E5FB 6E4F 7862 568A 08ED 0895 1A87

To claim this, I am signing this object:

@dpwrussell
dpwrussell / imagetags.py
Last active May 17, 2016
Example of querying tags from images
View imagetags.py
import omero
from omero.gateway import BlitzGateway
from omero.sys import ParametersI
import sys
USERNAME = ''
PASSWORD = ''
HOST = 'localhost'
PORT = 4064
@dpwrussell
dpwrussell / logback_syslog.xml
Last active Apr 20, 2016
omero syslog ansible
View logback_syslog.xml
<?xml version="1.0" encoding="UTF-8"?>
<included>
<!-- syslog ///////////////////////////////////////////////////////////////// -->
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender">
<syslogHost>localhost</syslogHost>
<facility>local6</facility>
<suffixPattern>OMERO [%thread] %logger %msg</suffixPattern>
</appender>
</included>
@dpwrussell
dpwrussell / omero_test.yml
Created Apr 12, 2016
OMERO figure script ansible test playbool
View omero_test.yml
---
- hosts: itlomerod01
remote_user: root
tasks:
# get the id of an installed script
- name: check if figure script has been installed (database)
shell: "{{ omero_base }}/OMERO.server/current/bin/omero script list | grep 'Figure_To_Pdf' | gawk -F '|' '{ print $1 }'"
sudo: yes
sudo_user: omero-local
@dpwrussell
dpwrussell / js-class-method-binding-demo.js
Created Nov 9, 2015
Javascript Class Method Binding Demonstration
View js-class-method-binding-demo.js
'use strict';
class MethodBindingTest {
constructor() {
this.x = 5;
// Bind this method
this.boundPrintX = this.boundPrintX.bind(this);
}
@dpwrussell
dpwrussell / marshmallow_sa_inherit_pk.py
Created Aug 28, 2015
MarshmallowSqlAlchemy's issue with overriden ids not being serialized
View marshmallow_sa_inherit_pk.py
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker, relationship
from sqlalchemy.ext.hybrid import hybrid_property
from marshmallow_sqlalchemy import ModelSchema
engine = sa.create_engine('sqlite:///:memory:')
session = scoped_session(sessionmaker(bind=engine))
Base = declarative_base()
@dpwrussell
dpwrussell / marshmallow_sqlalchemy_issue_one_or_many_to_zero_or_one.py
Last active Aug 27, 2015
MarshmallowSqlalchemy issue with one/many to zero/one using sqlalchemy's uselist=False
View marshmallow_sqlalchemy_issue_one_or_many_to_zero_or_one.py
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker, relationship
from sqlalchemy.ext.hybrid import hybrid_property
from marshmallow_sqlalchemy import ModelSchema
engine = sa.create_engine('sqlite:///:memory:')
session = scoped_session(sessionmaker(bind=engine))
Base = declarative_base()