Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Historian(): | |
"""A simple historian class for logging simulation data. | |
Args: | |
item_id (str): a name for the identifier of the tracked objects | |
data_callbacks (dict): a dictionary of name:function pairs where name | |
is a string label for the data element being recorded, and the function | |
returns the current value for the data element. | |
""" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, shutil | |
if 'google.colab' in sys.modules: | |
!pip install -q pyomo | |
!wget -N -q "https://ampl.com/dl/open/ipopt/ipopt-linux64.zip" | |
!unzip -o -q ipopt-linux64 | |
ipopt_executable = '/content/ipopt' | |
else: | |
ipopt_executable = shutil.which('ipopt') | |
if ipopt_executable is None: | |
raise FileNotFoundError('Could not locate the ipopt executable.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rm -r --cached some-directory | |
git commit -m 'Remove the now ignored directory "some-directory"' | |
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href='http://fonts.googleapis.com/css?family=Fenix' rel='stylesheet' type='text/css'> | |
<link href='http://fonts.googleapis.com/css?family=Alegreya+Sans:100,300,400,500,700,800, | |
900,100italic,300italic,400italic,500italic,700italic,800italic,900italic' rel='stylesheet' type='text/css'> | |
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:300,400' rel='stylesheet' type='text/css'> | |
<link href='http://fonts.googleapis.com/css?family=Crimson+Text' rel='stylesheet' type='text/css'> | |
<link href='http://fonts.googleapis.com/css?family=Kameron' rel='stylesheet' type='text/css'> | |
<link href='http://fonts.googleapis.com/css?family=Lato:200' rel='stylesheet' type='text/css'> | |
<link href='http://fonts.googleapis.com/css?family=Lato:300' rel='stylesheet' type='text/css'> | |
<link href='http://fonts.googleapis.com/css?family=Lato:400' rel='stylesheet' type='text/css'> | |
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dateutil import rrule | |
import datetime | |
# Generate ruleset for holiday observances on the NYSE | |
def NYSE_holidays(a=datetime.date.today(), b=datetime.date.today()+datetime.timedelta(days=365)): | |
rs = rrule.rruleset() | |
# Include all potential holiday observances | |
rs.rrule(rrule.rrule(rrule.YEARLY, dtstart=a, until=b, bymonth=12, bymonthday=31, byweekday=rrule.FR)) # New Years Day |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% APMONITOR A class for processing APMonitor models on a remote server. | |
% | |
% SYNOPSIS | |
% | |
% apmonitor(server) | |
% Initializes an APMonitor application on a remote server and | |
% returns an object with methods to upload, solve, and download | |
% application data. Results in an error if the server does not | |
% respond. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Texpad build (.tpbuild) for standalone | |
pdflatex "$TEXPAD_ROOTFILE" | |
convert -density 300 "$TEXPAD_ROOTFILE_NO_EXT".pdf "$TEXPAD_ROOTFILE_NO_EXT".png | |
rm "$TEXPAD_ROOTFILE_NO_EXT".aux | |
rm "$TEXPAD_ROOTFILE_NO_EXT".log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% STOCK A Matlab class for obtaining quotes from Yahoo Finance. | |
% | |
% SYNOPSIS | |
% | |
% stock(symbol,speriod,sfreq) | |
% Creates an object for the current quote and historical prices for | |
% the stock denoted by SYMBOL. | |
% | |
% symbol String or cell array of strings denoting desired stocks. | |
% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function str = displaytable(A,rnames,cnames,fmt,tableformat,fname) | |
% DISPLAYTABLE Convert a matrix to a printable table. | |
% | |
% STR = DISPLAYTABLE(A,RNAMES,CNAMES,FMT,TABLEFORMAT,FNAME) | |
% Formats a matrix as a table with row and column labels. The result is | |
% a string that will print as a formatted table. Useful labeling and | |
% annotating computational results. | |
% | |
% REQUIRED PARAMETERS |
NewerOlder