Created
June 22, 2023 01:01
-
-
Save echometerain/275fd0c1ea5932c4dfa272c086f915c6 to your computer and use it in GitHub Desktop.
Bash alias to partially convert p5.js to p5 python
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
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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment