Skip to content

Instantly share code, notes, and snippets.

View dpwrussell's full-sized avatar

Douglas Russell dpwrussell

View GitHub Profile
@dpwrussell
dpwrussell / rename.py
Created July 6, 2017 19:48
AT File Renaming
#!/usr/bin/env python3
import os
import re
r = re.compile(r'(\w\s-\s\d\d\(fld\s\d\swv\s\w+\s-\s[\w]+-\stime)(\s\d+)(\s-\s\d+\sms)(\)\.tif)')
d = os.path.abspath('files/')
all_files = [f for f in os.listdir(d) if os.path.isfile(os.path.join(d, f))]
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@dpwrussell
dpwrussell / Dockerfile
Last active April 6, 2017 14:49
webtagging-docker52
FROM omero-grid-web52
MAINTAINER douglas_russell@hms.havard.edu
USER root
RUN pip install -i https://testpypi.python.org/pypi omero-webtagging-autotag \
&& pip install -i https://testpypi.python.org/pypi omero-webtagging-tagsearch
USER omero
RUN /home/omero/OMERO.server/bin/omero config append omero.web.apps '"omero_webtagging_autotag"' \
&& /home/omero/OMERO.server/bin/omero config append omero.web.ui.center_plugins '["Auto Tag", "omero_webtagging_autotag/auto_tag_init.js.html", "auto_tag_panel"]' \
@dpwrussell
dpwrussell / Dockerfile
Last active April 6, 2017 14:46
webtagging-docker53
FROM omero-grid-web53
MAINTAINER douglas_russell@hms.havard.edu
USER root
RUN pip install -r /home/omero/OMERO.server/share/web/requirements-py27.txt
RUN pip install -i https://testpypi.python.org/pypi omero-webtagging-autotag \
&& pip install -i https://testpypi.python.org/pypi omero-webtagging-tagsearch
USER omero
RUN /home/omero/OMERO.server/bin/omero config append omero.web.apps '"omero_webtagging_autotag"' \
library("mosaic")
library("Hmisc")
# Load the movies and remove non-US/UK observations
allMovies <- read.csv('movie_metadata.csv', na.strings=c("", "NA"))
subsetMovies <- subset(allMovies, country=='USA' | country=='UK')
# Examine the variables of interest for NA
# No budget
nrow(subsetMovies[is.na(subsetMovies$budget),])
@dpwrussell
dpwrussell / sqlalchemy_subqueryload_poly.py
Last active August 15, 2016 15:44
SQLAlchemy Subqueryload Poly
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):
*.sql
*.sed
@dpwrussell
dpwrussell / keybase.md
Created July 12, 2016 14:28
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 17:09
Example of querying tags from images
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 April 20, 2016 14:24
omero syslog ansible
<?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>