-
-
Save gauravssnl/742cef04808e0b83d20bf2b9cd9f9dcd to your computer and use it in GitHub Desktop.
Poor dev's Rust Compiler
This file contains hidden or 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
fn main() { | |
println!("Hello World!"); | |
} |
This file contains hidden or 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 | |
# Requires `jq`, because I am lazy | |
# jq: https://stedolan.github.io/jq/ | |
[ $# -ne 1 ] && echo "Usage: $(basename $0) file.rs" && exit | |
echo "{\"channel\":\"stable\",\"crateType\":\"bin\",\"mode\":\"debug\",\"tests\":false,\"code\":\"$(sed -e 's/"/\\"/g' -e 's/$/\\n/g' $1|tr -d '\n')\"}" \ | |
| curl -skH"Content-Type:application/json" https://play.rust-lang.org/execute -d@- \ | |
| jq .stdout \ | |
| sed -e 's/^"//' -e 's/"$//' -e 's/\\n/\n/g' | sed '/^$/d' |
This file contains hidden or 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 | |
[ $# -ne 1 ] && echo "Usage: $(basename $0) file.rs" && exit | |
echo "{\"channel\":\"stable\",\"crateType\":\"bin\",\"mode\":\"debug\",\"tests\":false,\"code\":\"$(sed -e 's/"/\\"/g' -e 's/$/\\n/g' $1|tr -d '\n')\"}" | curl -skH"Content-Type:application/json" https://play.rust-lang.org/execute -d@- | jq .stdout | sed -e 's/^"//' -e 's/"$//' -e 's/\\n/\n/g' | sed '/^$/d' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment