This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Requires numpy and matplotlib | |
# This file is in public domain | |
def usage(): | |
import sys | |
print >>sys.stderr, sys.argv[0] + " [options] file1 [file2 file3 ...]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
./configure --with-features=huge --enable-pythoninterp --enable-python3interp --enable-perlinterp --enable-rubyinterp CFLAGS='-O3 -Wall -Wextra' $* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[14pt]{beamer} | |
\usetheme{Singapore} | |
\begin{document} | |
\begin{frame} | |
\end{frame} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_matrix_from_file(f): | |
""" | |
This function is to load an ascii format matrix (float numbers separated by | |
whitespace characters and newlines) into a numpy matrix object. | |
f is a file object or a file path. | |
""" | |
import types | |
import numpy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 2 3 4 | |
9 8 7 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Derivative in MatLab. | |
% | |
% Copyright (C) 2013 Hong Xu <[email protected]> | |
% All rights reserved. | |
% | |
% License: | |
% | |
% Redistribution and use in source and binary forms, with or without | |
% modification, are permitted provided that the following conditions are met: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk '{ print $NR }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// kronecker product | |
// | |
// kprod = a kron b | |
// | |
// size of a is (ma, na) | |
// size of b is (mb, nb) | |
// example: | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Wrap Macports command (any executables installed by Macports). | |
if [ "$#" -le 0 ]; then | |
echo "Usage: $0 command [arg1, arg2, ...]" >&2 | |
exit 1 | |
fi | |
if [[ -z $MACPORTS_PREFIX ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Often when your file needs to go through a few filters, the number of | |
# backslashes needed for escaping is just horrible! This small script just | |
# solves the problem. Works well on Python 2.6 and later as well as Python 3. | |
# This file is under public domain. | |
# Copyright (C) 2013 Hong Xu <[email protected]> | |
from __future__ import print_function |