Skip to content

Instantly share code, notes, and snippets.

@givens
givens / Select Pre-defined Random Text Expander Snippet
Last active December 10, 2015 02:29
The Python list, L, contains references to Text Expander snippets. These snippets are "tag lines" for my email. Using Text Expander, I reference the snippet with a few short keystrokes. When the code executes in Text Expander 4.0.3, it randomly selects one of the snippets. It pulls a random tag line into my email. In the future, I'd like to upda…
#!/usr/bin/env python
from __future__ import print_function
import random, sys
L = [",,spe", ",,ipe", ",,adp", ",,phd", ",,gg"]
l = "%snippet:"+random.choice(L)+"%"
print(l,end="",file=sys.stdout)
@givens
givens / RESHAPE
Created December 14, 2012 16:28
Mathematica RESHAPE array command
Reshape[list_, dimensions_] :=
First[Fold[Partition[#1, #2] &, Flatten[list], Reverse[dimensions]]]
@givens
givens / std_imports.py
Created April 6, 2011 08:33
Standard python imports
##
## IMPORTS
##
from scipy import *
from pylab import *