This file contains 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
/** | |
* Coordinates Transformations | |
* | |
* http://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle | |
* | |
* @param centerX | |
* @param centerY | |
* @param radius | |
* @param angleInDegrees | |
* @returns {string} |
This file contains 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
function cartesianToPolar(x,y){ | |
return { | |
radius: Math.sqrt( Math.pow(x, 2) + Math.pow(y, 2) ), | |
alpha: Math.atan2(y, x) | |
} | |
} |
This file contains 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
function polarToCartesian(radius,radian){ | |
return { | |
x:radius*Math.cos(radian), | |
y:radius*Math.sin(radian) | |
} | |
} |
This file contains 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
// thx tomy! http://www5.airnet.ne.jp/tomy/cpro/sslib12.htm | |
function cartesian2polar(x,y,z) { | |
var obj = new Object; | |
obj.r = Math.sqrt( x*x + y*y + z*z ); | |
if (x != 0.0) | |
obj.phi = Math.atan2( y, x ); | |
else { | |
if (y < 0.0) |
This file contains 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
import Data.Vector ((!)) | |
import qualified Data.Vector as V | |
import Data.Vector.Generic.Mutable (write) | |
step ws state = case updatable of [] -> state | |
(i,_):_ -> V.modify (\v -> write v i (o i)) state | |
where | |
n = V.length state | |
w i j = ws ! i ! j |
This file contains 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
# Find tutorial; | |
# http://www.grymoire.com/Unix/Find.html | |
# find files modified less than 5 days ago | |
$ find . -type f -mtime -5 -print | xargs ls -l | |
# find files (with spaces in name) modified less than 5 days ago | |
$ find . -type f -mtime -5 -print0 | xargs -0 ls -l | |
# find & remove directories older than 200 days |
This file contains 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
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf | |
# found at https://bbs.archlinux.org/viewtopic.php?id=65036 | |
# some automation (merge all in current directory): | |
find . -type f -print0 | xargs -0 gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="/path/finished.pdf" |
This file contains 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
zip -r [filename.zip] [foldername] -x "*.DS_Store" -x *.git* |
This file contains 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/bash | |
if [ $# -ne 1 ]; then | |
echo "Usage: ${0} directory" | |
exit 1 | |
fi | |
if [ -d ${1} ]; then | |
DIR_NAME=$(basename ${1}) |
This file contains 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
zip -d archive.zip "*/*.DS_Store" |
NewerOlder