Skip to content

Instantly share code, notes, and snippets.

View echometerain's full-sized avatar

echometerain echometerain

View GitHub Profile
@echometerain
echometerain / gist:275fd0c1ea5932c4dfa272c086f915c6
Created June 22, 2023 01:01
Bash alias to partially convert p5.js to p5 python
alias j2p="xclip -o | sed -r 's@//@#@g; s/var\s//g; s/\;//g; s/===/==/g; s/}\s//g; s/}//g; s/else\sif\s\(/elif /g; s/else\sif\(/elif /g; s/if\s\(/if /g; s/if\(/if /g; s/else\s\{/else:/g; s/else\{/else:/g; s/&&/and/g; s/&/and/g; s/\|\|/or/g; /\s=\sfunction/s/^/def /; s/\s=\sfunction//g; /^def/! s/\)\s\{/:/g; /^def/! s/\)\{/:/g; s/\s\{/:/g; s/\{/:/g; s/mouseClicked\(\)/mouseClicked\(e\)/g; s/true/True/g; s/false/False/g; s/this./self./g; s/new\s//g; s/.push\(/ += [/g; s/\+\+/ += 1/g; s/\-\-/ -= 1/g; s/sin\(/sin\(degrees\(/g; s/cos\(/cos\(degrees\(/g; s/tan\(/tan\(degrees\(/g; s/getImage\(/loadImage\(/g; s/keyPressed\(\)/keyPressed\(e\)/g; s/keyReleased\(\)/keyReleased\(e\)/g; s/pushMatrix\(\)/push\(\)/g; s/popMatrix\(\)/pop\(\)/g; s/\!==/\!=/g; s/null/None/g; s/background\(\)/background\(255\)/g' | xclip -selection clipboard"