Skip to content

Instantly share code, notes, and snippets.

😎
Solving solar

Mark Mikofski mikofski

😎
Solving solar
Block or report user

Report or block mikofski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dcloss.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mikofski
mikofski / keyfile.json
Last active Mar 13, 2020
use Requests with OAuth 1.0 and Netflix REST API 1.5
View keyfile.json
{
"key": "<your-netflix-key>",
"secret": "<your-netflix-secret>"
}
@mikofski
mikofski / polyDer2D.m
Last active Mar 13, 2020
horners method in 2-D
View polyDer2D.m
function [fx,fy] = polyDer2D(p,x,y,n,m)
%POLYDER2D Evaluate derivatives of 2-D polynomial using Horner's method.
% F = POLYDER2D(P,X,Y,N,M) evaluates the derivatives of 2-D polynomial P at
% the points specified by X and Y, which must have the same dimensions. The
% outputs FX and FY will have the same dimensions as X and Y. N and M specify
% the order of X and Y respectively. Polynomial coefficients are in the
% following order.
%
% F(X,Y) = P_1 * X^N * Y^M + P_2 * X^{N-1} * Y^M + ... + P_{N+1} * Y^M + ...
% P_{N+2} * X^N * Y^{M-1} + P_{N+3} * X^{N-1} * Y^{M-1} + ... + P_{2*(N+1)} * Y^{M-1} + ...
@mikofski
mikofski / polyfitZero.m
Last active Mar 13, 2020
fit (x,y) to polynomial of degree (degree) forcing y-intercept to zero
View polyfitZero.m
function [p,S,mu] = polyfitZero(x,y,degree)
% POLYFITZERO Fit polynomial to data, forcing y-intercept to zero.
% P = POLYFITZERO(X,Y,N) is similar POLYFIT(X,Y,N) except that the
% y-intercept is forced to zero, i.e. P(N) = 0. In the same way as
% POLYFIT, the coefficients, P(1:N-1), fit the data Y best in the least-
% squares sense. You can also use Y = POLYVAL(PZERO,X) to evaluate the
% polynomial because the output is the same as POLYFIT.
%
% [P,S,MU] = POLYFITZERO() Return structure, S, similar to POLYFIT for use
% with POLYVAL to calculate error estimates of predictions with P.
View EncryptUtil_test.m
%% initialize workspace
close('all'),clear('all'),clc
rmdir('keys','s') % delete old keys
%% test encryption
PANGRAM = 'The quick brown fox jumped over the lazy dog.';
EncryptionUtil.testJschSECSH(PANGRAM) % run test
%% make SSH keys in workspace
keyFactory = java.security.KeyFactory.getInstance('RSA'); % make a key factory
% read public OpenSSH key
[keyln, totlines] = EncryptionUtil.readJschKeyFile('keys/publicJschSECSH.key',7);
@mikofski
mikofski / timeseries.py
Last active Mar 13, 2020
time series examples that subclass numpy ndarray
View timeseries.py
#! /usr/bin/env python
import numpy as np
from datetime import datetime, time, timedelta
import pytz
class Timeseries(object):
def __init__(self, x, t):
self.x = np.array(x)
self.t = np.array(t,dtype='datetime64[s]')
@mikofski
mikofski / ny_nsrdb_map.geojson
Last active Mar 13, 2020
NSRDB NY STATIONS
View ny_nsrdb_map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mikofski
mikofski / PV-system-MPP-implicit-solver.ipynb
Last active Mar 13, 2020
proof of an implicit solver
View PV-system-MPP-implicit-solver.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mikofski
mikofski / Gaussian_elimination.py
Last active Mar 1, 2020
numpy scipy gaussian elimination using LU decomposition with pivoting
View Gaussian_elimination.py
#! /usr/bin/env python
"""
Solve linear system using LU decomposition and Gaussian elimination
"""
import numpy as np
from scipy.linalg import lu, inv
def gausselim(A,B):
You can’t perform that action at this time.