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 / ssshow.py
Created March 6, 2010 00:29
A quick lil' python script that uses gnumeric's ssconvert and the standard library's csv to, y'know, show me the contents of gnumeric files wif less.
#!/usr/bin/env python
from os import system
from re import sub
from sys import argv
from csv import reader, writer
def main(filename):
system('ssconvert -T Gnumeric_stf:stf_csv '+filename+' /tmp/ssconv1.csv')
read = reader(open('/tmp/ssconv1.csv','r'), 'excel')
@jfhbrook
jfhbrook / crossings.py
Created March 23, 2010 01:30
stupid code that does things with shapefiles or something
#!/usr/bin/env python
#experimenting with Shapely
from shapely import geometry, wkb
#also need gdal stuff--YUCK :C
from osgeo import osr, ogr
#since these things take time...
from progressbar import ProgressBar, Percentage, Bar
@jfhbrook
jfhbrook / tsl_week_8.m
Created March 30, 2010 19:20
Soon to be a part of the libtsl repository, this file is used to compare real-world results what the pump affinity laws predict.
% tsl_week_8.m
% Written by Joshua Holbrook, week of March 28th 2010
% Since people actually seem to be using this, it's licensed
% under the WTFPL (http://sam.zoy.org/wtfpl/).
% A little snafu with matlab is that you can't define a function within a
% non-function script. So, I wrapped these codes in a function!
function tsl_week_8()
% Prompt 1: *Using Matlab*, perform a sum of least squares non-linear
@jfhbrook
jfhbrook / sigdigs.py
Created April 9, 2010 00:49
a long time ago, I was gonna try doing this for matlab. This looks easier. :S
"""
A sketch for an idea I've had since forever regarding significance arithmetic.
http://en.wikipedia.org/wiki/Significance_arithmetic
Yeah, that annoying shit you did in chemistry class and hoped never to see again.
With this, maybe you can?
"""
class significants(number):
# note: not actually sure how to do some of these things
def __init__:
#!/usr/bin/octave --silent
% This test demonstrates the use of GNU octave with scripts.
% Use: chmod +x test.m && ./test.m
% Not sure if/when this will be handy. Being able to do this
% with MATLAB would probably be more useful for me.
disp('hello world!');

matlab's cli interpreter is dumber than octave, in that it doesn't know what to do with the #! magic number, and it doesn't know to exit at the end of a file (I can actually see the point in that, kind of). So, this is my quick attempt to make something that would allow you to, well,

./test.m

It ALMOST works. ALMOST. No errors are thrown or anything! :v On the other hand, you don't actually see "hello world!!!!1!" either. Haven't tried anything like, say, printing to a file.

@jfhbrook
jfhbrook / README.md
Created June 12, 2010 00:20
A server-side parallel to arsc_remote, so to speak.

#ABOUT: #

After talking with a colleague about some stuff, I came to this realization that the ARSC user experience could use some explaining too. At the same time, I've had my own issues with wanting to run things without having admin priveleges, which I'm not used to. In addition to that, the ARSC workstation setups have their own SNAFUS for us to deal with.

#TODO: #

@jfhbrook
jfhbrook / gol.html
Created June 23, 2010 20:40
Same game of life.
<html>
<head>
<title>Like The Sims, but without the spiralling depression.</title>
<script src="raphael.js" type="text/javascript" charset="utf-8"></script>
</head>
<body style="background-color:#333333;">
<script>
//Trying to implement Conway's Game of Life in js.
//I'm pretty dumb with js though.
//Requires raphael.js.

#TABULAR

Scientists don't just work with matrices. They work with tabular data.

Here are some things you might want to do with tabular data:

  • Import data from csv, excel, xml, etc.
  • Pull out data based on various keys
  • Take multiple datasets and mash them together somehow (joins)
  • Sort your data
Temperature (C) Pressure (Mpa) Location time_fail (s)
10 0.1 Los Alamos 5.211
20 0.1 Los Alamos 10.411
30 0.1 Los Alamos 15.611
10 0.25 Los Alamos 5.26875
20 0.25 Los Alamos 10.46875
30 0.25 Los Alamos 15.66875
10 0.5 Los Alamos 5.475
20 0.5 Los Alamos 10.675
30 0.5 Los Alamos 15.875