Skip to content

Instantly share code, notes, and snippets.

View jmuhlich's full-sized avatar

Jeremy Muhlich jmuhlich

  • Harvard Medical School Laboratory of Systems Pharmacology
  • Boston, MA
View GitHub Profile
-- See this document for more information on making Pong:
-- http://elm-lang.org/blog/Pong.elm
--
-- Make the Pong field look nicer. Add a line (or dotted line) at mid-field.
import Keyboard
import Text
import Window
-- Inputs
@jmuhlich
jmuhlich / main.elm
Last active August 29, 2015 14:05
elm slider test WIP
import Mouse
import Graphics.Input (Input, input, hoverable)
type SliderInput = { mouseX:Int, mouseY:Int, mouseDown:Bool }
sliderInput = SliderInput <~ Mouse.x
~ Mouse.y
~ Mouse.isDown
type Slider = { value:Int, isMoving:Bool }
defaultSlider : Slider
@jmuhlich
jmuhlich / dose_response.elm
Created September 5, 2014 04:38
Parametrizing perturbagen dose-response relationships
import String
import Array
import Graphics.Input (Input, input)
import Graphics.Input.Field as Field
logistic : Float -> Float -> Float -> Float -> Float -> Float
logistic x emin emax mid slope =
( (emin-emax) / (1 + ((x/mid)^slope) ) ) + emax
lcurve : Float -> Float -> Float -> Path
@jmuhlich
jmuhlich / gist:b6e349c5d80ec3897a77
Created June 3, 2015 15:56
profile top-level code with line_profiler
# Hacks to get line_profiler to profile top-level code in a script/module.
# 1. The interface only allows profiling functions, but the core profiling logic
# actually works directly with code objects. We create a new function object
# from the code at the top level of the script to profile, and call
# profile.add_function on it. This is enough to trick the bookkeeping code in
# line_profiler to include the top-level code.
# 2. Even though the entirety of the top-level code is profiled in full, the
# results printer will stop at the first function definition, class definition,
@jmuhlich
jmuhlich / model1.py
Last active October 1, 2015 16:12
pysb fridlyand diabetes model test
from pysb import *
Model()
Monomer('Glucose')
Monomer('Vp')
Parameter('kf', .015)
Parameter('kr', .015)
Parameter('Vsk', -18)
@jmuhlich
jmuhlich / gist:cacd807cde0446fb5fad
Last active May 14, 2022 21:03
Notes on StarCluster and EC2
@jmuhlich
jmuhlich / mymod.py
Created May 15, 2016 01:16
python logging minimal example
import logging
logger = logging.getLogger(__name__)
def foo(a, b):
logger.info('foo(%s, %s)', a, b)
@jmuhlich
jmuhlich / sqlalchemy_subqueryload_poly.py
Last active August 15, 2016 15:44 — forked from dpwrussell/sqlalchemy_subqueryload_poly.py
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):
@jmuhlich
jmuhlich / fm_jaydebeapi.py
Created January 5, 2017 21:19
Connect to FileMaker Pro Server in Python using JDBC driver via jaydebeapi
import jaydebeapi
import pandas as pd
def cursor_to_df(cursor):
df = pd.DataFrame(cursor.fetchall())
df.columns = [d[0] for d in cursor.description]
return df
fmsHostname = 'fmprod13.med.harvard.edu'
fmFilename = 'HITS_Reagent_Tracker_2_0'
@jmuhlich
jmuhlich / screen data processing.ipynb
Last active May 26, 2017 19:08
Explore some snippets of code from the ramm_screening_data_processing project.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.