Skip to content

Instantly share code, notes, and snippets.

@samtx
samtx / countries.json
Created June 6, 2021 21:08
Countries of the world in JSON format
[
"Afghanistan",
"Albania",
"Algeria",
"American Samoa",
"Andorra",
"Angola",
"Anguilla",
"Antarctica",
"Antigua and Barbuda",
@samtx
samtx / ..meen431_project.md
Last active March 26, 2018 00:01
Texas A&M, MEEN 431, Dynamic Systems and Controls, Project

Texas A&M, MEEN 431, Dynamic Systems and Controls, Project Sam Friedman, Nilesh Pore

@samtx
samtx / README.md
Last active March 6, 2018 01:26
Setup for Matlab, Python, OpenMDAO, and OpenAeroStruct on TAMU HPC cluster

Setup instructions

TAMU HPRC Python virtual environment setup: https://hprc.tamu.edu/wiki/SW:Python

Summary

On the Ada cluster, run these commands one after the other. They probably also work on the Terra and Curie clusters.

module load Python/2.7.12-foss-2017A myPython/2.7.12-foss-2017A

$MYCREATEVIRTENV
@samtx
samtx / stats_ch10p11.py
Created April 22, 2017 20:27
Estimate mean of gamma distribution. Casella & Burger, Ch.10, Exercise 11
# Inference Statistics
# Casella and Berger
@samtx
samtx / config
Last active April 29, 2024 23:57
Pretty git log graphs
# add to ~/.gitconfig file
# By Slipp D. Thompson, at http://stackoverflow.com/questions/1838873/visualizing-branch-topology-in-git/34467298#34467298
[alias]
lg = !"git lg1"
lg1 = !"git lg1-specific --all"
lg2 = !"git lg2-specific --all"
lg3 = !"git lg3-specific --all"
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
@samtx
samtx / README.md
Created March 9, 2017 21:15
Sam's Python Setup

Modules/Commands to install

use pip install <module> --user to install to user account without root privileges

  • Cython
  • numpy
  • scipy
  • openmdao
  • cprofilev
  • line_profiler
@samtx
samtx / mat2np.m
Created July 21, 2016 05:37
Matlab functions for converting back and forth between Numpy ndarray objects and Matlab matrices
function npary = mat2np(mat)
% convert matlab matrix to python (Numpy) ndarray
sh = fliplr(size(mat));
mat2 = reshape(mat,1,numel(mat)); % [1, n] vector
npary = py.numpy.array(mat2);
npary = npary.reshape(sh).transpose(); % python ndarray
end
function mat = np2mat(npary)
% convert python (Numpy) ndarray to matlab
sh = double(py.array.array('d',npary.shape));
npary2 = double(py.array.array('d',py.numpy.nditer(npary)));
mat = reshape(npary2,fliplr(sh))'; % matlab 2d array
end