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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mikofski
mikofski / spectral_mismatch.ipynb
Last active January 7, 2021 17:42
spectral mismatch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mikofski
mikofski / autovivication.json
Created July 17, 2015 06:00
autovivication
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
@mikofski
mikofski / gen_refs.js
Last active August 29, 2015 14:14
reference generator using counters
/* Build a references section that lists URLs of hyperlinks
* with specified class "ref". Put list in div element with
* specified id "references". Use CSS class called references
* that uses counters and ::before psuedo-element to add
* brackets around reference list numbers.
* links in body look like this:
* blah <a href="URL>reference</a><a class="ref"><a> */
document.body.onload = gen_refs("a", "references", "ref");
function gen_refs(tagname, refsname, classname) {
var alltags = document.getElementsByTagName(tagname);
@mikofski
mikofski / rc2a1.m
Created November 25, 2014 20:27
convert MS Excel row-column reference to A1 reference
function [a1,aa] = rc2a1(row,col)
% RC2A1 convert row, column reference to A1 reference for excel
% A1 = RC2A1(ROW,COL) returns the equivalent reference as a string
% for the given row, ROW, and column, COL, numbers.
a1 = char(64+mod(col-1,26)+1);
xcol = ceil(col/26)-1;
if xcol>0
[~,aa] = rc2a1(row,xcol);
a1 = [aa,a1];
@mikofski
mikofski / gen_toc.html
Last active August 29, 2015 14:06
generate table of contents
<html>
<head>
<!-- either head or body -->
<style type="text/css">
.toc_item {
color: green;
}
</style>
<!-- css class -->
</head>
@mikofski
mikofski / memcached_service.py
Created August 26, 2014 16:54
memcached service for windows
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Attribution: Hijacked from tracservice.py by Florent Xicluna <laxyf@yahoo.fr>
# http://trac-hacks.org/wiki/WindowsServiceScript
#
# To use this class, users must do the following:
# 1. Download and install the PyWin32all package
# (http://starship.python.net/crew/mhammond/win32/)
# 2. Edit the constants section with the proper information.
@mikofski
mikofski / Django_view_utilities.py
Last active August 29, 2015 14:05
Django view utilities to add GET parameters to context and to use a Bootstrap navbar login template
from functools import wraps
from django.contrib.auth.views import login as auth_login
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect, QueryDict
from django.core.urlresolvers import reverse, resolve
from django.template.response import TemplateResponse
def add_GET_to_context(*keys):
"""
Check view's URL GET query string for keys and add values to context data
@mikofski
mikofski / excel_diff.py
Created July 15, 2014 20:31
diff of excel file in Git repository index and working copy
#! /usr/bin/env python
"""
diff of excel files
"""
from dulwich.repo import Repo # import Repo object from dulwich
import sys
import os
from openpyxl import load_workbook
@mikofski
mikofski / Gaussian_elimination.py
Last active September 29, 2022 03:31
numpy scipy gaussian elimination using LU decomposition with pivoting
#! /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):