Skip to content

Instantly share code, notes, and snippets.

View mikofski's full-sized avatar
😎
Solving solar

Mark Mikofski mikofski

😎
Solving solar
View GitHub Profile
@mikofski
mikofski / README.md
Last active July 26, 2016 17:05
Using org.json in MATLAB
@mikofski
mikofski / keyfile.json
Last active March 13, 2020 20:27
use Requests with OAuth 1.0 and Netflix REST API 1.5
{
"key": "<your-netflix-key>",
"secret": "<your-netflix-secret>"
}
@mikofski
mikofski / output.md
Last active December 12, 2015 10:19
get rid of nan (or inf,-9999,0 or any flag) using circshift

Here's an example:

>> [data,shifts] = smooth_flag_wlast_nonflag(data_copy,NaN,true)

    0:     4    5  NaN    1    2    3  NaN  NaN  NaN    5    3  NaN  NaN    3
    1:     4    5    5    1    2    3    3  NaN  NaN    5    3    3  NaN    3
    2:     4    5    5    1    2    3    3    3  NaN    5    3    3    3    3
    3:     4    5    5    1    2    3    3    3    3    5    3    3    3    3
data =
@mikofski
mikofski / polyDer2D.m
Last active March 13, 2020 20:26
horners method in 2-D
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 / examples.m
Last active December 16, 2015 21:59
Spline2D - tools to fit 2D functions with piecewise continuous polynomials.
%% spline2D example
% Initialize a clean workspace.
% Save your work first!
clear all
close all
%% Set up test 2D polynomial.
[x,y] = meshgrid(-3:4,-3:4); % independent variables
% EG: Make a test 2D polynomial with coeffiecients 1, 2, 3, 4, 5, 6
% that is 2nd-order (quadratic) in x-direction, and 1st order (linear)
% in y-direction.
@mikofski
mikofski / cbox.py
Last active December 17, 2015 14:08
async Tk waitbox widget
"""
An example of a combobox that adds user entries using key binding to return
"""
from Tkinter import *
from ttk import *
def on_combobox_selected(event):
new_value = event.widget.get()
is_in_list = event.widget.current()
@mikofski
mikofski / blogger_codestyle.html
Last active December 18, 2015 18:19
CSS inline and block code classes for blogger
<!-- begin CSS styles -->
<head><style type="text/css">
.block-code{
background-color: pink;
border-style: solid none;
border-color: red white;
font-family: "Courier New", Courier, monospace;
}
.inline-code {
@mikofski
mikofski / ez_Notebook.py
Last active November 12, 2020 09:06
Python 2 version of ttk Notebook Demo by courtesy of Jane
#! /usr/bin/env python
from Tkinter import *
from ttk import *
root = Tk() # create a top-level window
master = Frame(root, name='master') # create Frame in "root"
master.pack(fill=BOTH) # fill both sides of the parent
@mikofski
mikofski / scrolled_lists.py
Created June 25, 2013 21:35
scroll 2 listboxes in paned windows
#! /usr/bin/env python
from Tkinter import *
from ttk import *
import calendar
root = Tk()
master = Frame(root)
@mikofski
mikofski / scrolled_canvas.py
Last active December 19, 2015 05:49
ttk widgets
from Tkinter import Canvas, GROOVE, BOTH, X, Y, YES, RIGHT, LEFT, W
from ttk import Frame, Scrollbar, Checkbutton
import logging
import tkMessageBox
class ScrolledCanvas(Frame):
"""
A scrolling canvas of frames with checkboxes.
"""