Skip to content

Instantly share code, notes, and snippets.

View jfhbrook's full-sized avatar
💭
KNEE DEEP IN THE HOOPLA

Josh Holbrook jfhbrook

💭
KNEE DEEP IN THE HOOPLA
View GitHub Profile
@jfhbrook
jfhbrook / serious-question.md
Created July 11, 2014 17:49
I HERD U LIEK RUNTIME COMPLEXITY PUZZLES

What is the runtime complexity of:

for (var i = 1; i <= N; i *= 2) {
  for (var j = 1; j <= N; j *= 2) {
    for (var k = 1; k <= i; k++) {
      constantTime();
    }
  }
}
#include <iostream>
#include <string>
std::string eval(std::string input)
{
return std::string("\"") + input + std::string("\"");
}
const std::string PROMPT = "> ";
josh@koffing:~/dev/condenast/autopilot-vf$ netstat -r -n
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.1.1 UGSc 1 0 en0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 29 1542009 lo0
169.254 link#4 UCS 0 0 en0
192.168.1 link#4 UCS 0 0 en0
%mirror.m
%calculates mirror geometry action for MTUAF
function main()
%inputs, Units in inches
b=cart2both([-0.5,-0.5]); %bottom of screen
[th,r]=pol2cart(deg2rad(90),0.5*12); %top of screen
a=[th,r]+b{1};
topangle=deg2rad(40);%top inside angle
bottomangle=deg2rad(100);%bottom inside angle
m_dist=12;%distance down c where mirror starts
function xn = subset(x,n)
%subsets array x to xn with every nth row
%Written by Josh Holbrook and Marcus Curley
%for Thermal Systems Lab
xn = x(:,1);
for i = 1:n:size(x,2)
@jfhbrook
jfhbrook / lab1.py
Created February 8, 2010 05:11
My uncompleted calculations for a Thermal Systems lab.
import csv
from libtsl import subset,htparams,sphere
from numpy import array, exp
from matplotlib.pyplot import *
from keas.unit.unit import UnitConverter
#Reads in data points
datareader=csv.reader(open('friday_aluminum_sphere.csv'))
time=[]
temp=[]
@jfhbrook
jfhbrook / subset.m
Created February 10, 2010 02:15
A subsetting function for matlab for Thermal Systems
function xn = subset(x,n)
%subset(x,n)
%sub sets array x to xn with every nth row
%example:
%> x=[1:10];
%> subset(x,2)
% ans = [2 4 6 8]
xn = x(:,1);
for i = 1:n:size(x,2)
xn = [xn x(:,i)];
@jfhbrook
jfhbrook / subset.m
Created February 11, 2010 19:42
An alternate, shorter/vectorized version of subset.m from before. Product of bouncing ideas off Dustin.
function out=subset(in,n)
%subset(row_vector,spacing)
%subsets a row vector
%by Josh Holbrook and Dustin Ray
out=in(floor(linspace(1,size(in,2),n)));
end
@jfhbrook
jfhbrook / factorfinder.csv
Created February 12, 2010 00:49
A "Factor Finder" table for a digital viscometer from TSL.
model number rpm factor
RV 1 0.5 200
RV 1 1 100
RV 1 2 50
RV 1 2.5 40
RV 1 4 25
RV 1 5 20
RV 1 10 10
RV 1 20 5
RV 1 50 2
@jfhbrook
jfhbrook / segfault?!??!
Created February 14, 2010 07:45
A snippet for my comsol running scriptz0r
josh@gengar:~$ if echo 'segmentation fault {mlroot} {butt} {fruit}' | grep -c 'segmentation fault' ; then echo "true"; fi
1
true