Cartesian products in bash?
Given a directory with 2 sub-directories, A and B, this snippet will output: quartz ~/>; ls A B quartz ~/> ls -d1 */../*/ | sed ‘s;/../;->;g;s;/;;g’ A->A A->B B->A B->B
sstagg Uncategorized bash, cartesian, fish, shell, snippet 0 Comment
Given a directory with 2 sub-directories, A and B, this snippet will output: quartz ~/>; ls A B quartz ~/> ls -d1 */../*/ | sed ‘s;/../;->;g;s;/;;g’ A->A A->B B->A B->B
sstagg Uncategorized python, random, sampling, snippet, statistics, weighted 0 Comment
Let’s say you need to produce realistically distributed random selections from a list. For example, let’s say you’re writing a US meteor simulation game, and want to select the state the meteor will land in. Assuming that the impact site will be completely geographically random, then the following example will select a state, with a [...]
sstagg Uncategorized box model, css, html, less.css, padding, pattern, snippet, tech 0 Comment
Those of you (implicitly or explicitly) familiar with the css Box model will know that managing the width/height of elements that have padding applied can be a pain. Getting that number just right after adding borders, subtracting padding, and failing to finger-count is just boring, and error-prone, and that’s before the guy you’re designing for requests that [...]