Skip to content

Instantly share code, notes, and snippets.

View thearn's full-sized avatar

Tristan Hearn thearn

  • 19:11 (UTC -12:00)
View GitHub Profile
@thearn
thearn / run.py
Created March 11, 2015 17:48
simple complicated component
from openmdao.main.api import Component, Assembly
from openmdao.main.datatypes.api import Float
from pyoptsparse_driver.pyoptsparse_driver import pyOptSparseDriver
from pyopt_driver import pyopt_driver
from simple import SimpleComp, SimpleCompNoDeriv
import time
class parallel(Assembly):
def configure(self):
@thearn
thearn / flexglove
Created April 11, 2015 22:21
Energy gauntlet
int flexSensorPin_0 = A0; //analog pin for flex sensor
int flexSensorPin_1 = A4; //analog pin for flex sensor
int hand = 0;
int x_pin = A2;
int y_pin = A3;
int z_pin = A6;
int accelSrc = 3;
@thearn
thearn / The Technical Interview Cheat Sheet.md
Last active August 3, 2017 13:42 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
os:
- linux
- osx
sudo: false
language: generic
env:
- PY=2.7
import autograd.numpy as np
from autograd import grad
def f(A):
B = np.zeros((4,4))
B[:2, :2] = A
import requests
import json
import sys
import time
timer = {}
hub_url = "192.168.1.2"
hours_to_refresh_token = 8
class ZWaveController(object):
Abraham Gotthelf Kästner \nUniversität Leipzig (1739) -> Bernhard Friedrich Thibaut \nGeorg-August-Universität Göttingen (1796)
Abraham Gotthelf Kästner \nUniversität Leipzig (1739) -> Georg Christoph Lichtenberg \nGeorg-August-Universität Göttingen (1765)
Abraham Gotthelf Kästner \nUniversität Leipzig (1739) -> Heinrich Wilhelm Brandes \nGeorg-August-Universität Göttingen (1800)
Abraham Gotthelf Kästner \nUniversität Leipzig (1739) -> Johann Friedrich Pfaff \nGeorg-August-Universität Göttingen (1786)
Abraham Klein (Calovius) \nUniversität Rostock (1632) -> Aegidius Strauch \nMartin-Luther-Universität Halle-Wittenberg (1657)
Adolph Vorstius \nUniversità di Padova (1622) -> Franciscus de le Boë Sylvius \nUniversiteit Leiden and Universität Basel (1634)
Adriaan van den Spieghel \nUniversità di Padova and Université Catholique de Louvain (1603) -> Adolph Vorstius \nUniversità di Padova (1622)
Adriaan van den Spieghel \nUniversità di Padova and Université Catholique de Louvain (1603) -> Werner Rolfinck \nMartin-L
Connections for inlet.flow_in:
------------------------------
.foo -> {unconnected}
fc.subgroup.fs.exit_static.flow_static.Fl_O:stat:V (fc.Fl_O:stat:V) [ft/s] -> .Fl_I:stat:V (inlet.Fl_I:stat:V) [ft/s]
fc.subgroup.fs.exit_static.flow_static.Fl_O:stat:W (fc.Fl_O:stat:W) [lbm/s] -> .Fl_I:stat:W (inlet.Fl_I:stat:W) [lbm/s]
fc.subgroup.fs.totals.flow.Fl_O:tot:Cp (fc.Fl_O:tot:Cp) [Btu/(lbm*degR)] -> .Fl_I:tot:Cp (inlet.Fl_I:tot:Cp) [Btu/(lbm*degR)]
fc.subgroup.fs.totals.flow.Fl_O:tot:Cv (fc.Fl_O:tot:Cv) [Btu/(lbm*degR)] -> .Fl_I:tot:Cv (inlet.Fl_I:tot:Cv) [Btu/(lbm*degR)]
fc.subgroup.fs.totals.flow.Fl_O:tot:P (fc.Fl_O:tot:P) [lbf/inch**2] -> .Fl_I:tot:P (inlet.Fl_I:tot:P) [lbf/inch**2]
fc.subgroup.fs.totals.flow.Fl_O:tot:S (fc.Fl_O:tot:S) [Btu/(lbm*degR)] -> .Fl_I:tot:S (inlet.Fl_I:tot:S) [Btu/(lbm*degR)]
fc.subgroup.fs.totals.flow.Fl_O:tot:T (fc.Fl_O:tot:T) [degR] -> .Fl_I:tot:T (inlet.Fl_I:tot:T) [degR]
@thearn
thearn / implicit.py
Created February 8, 2016 20:53
working example
from openmdao.api import *
import numpy as np
"""
Test model:
-------------
Find value of state variable "x" such that the line 2*x + 1 has a specific
value of 'y1'
"""
import numpy as np
from openmdao.core.component import Component
from pycycle.constants import R_UNIVERSAL_ENG, MIN_VALID_CONCENTRATION
from openmdao.core.options import OptionsDictionary
from openmdao.components.indep_var_comp import IndepVarComp
from ad import adnumber