Last active
December 7, 2016 12:17
-
-
Save stpettersens/61ec2fe3e95d9a1618e08e35e66c6813 to your computer and use it in GitHub Desktop.
Crystal compilation on Windows using Linux local server.
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
sh crystal-compiler.sh |
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/sh | |
# Invoke the Crystal compiler. | |
cd job | |
mkdir -p target/release | |
dos2unix compile.sh > /dev/null 2>&1 | |
sh compile.sh | |
echo |
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/sh | |
# Invoke the compiled Crystal program. | |
echo | |
cd job | |
dos2unix prog.sh > /dev/null 2>&1 | |
sh prog.sh |
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
@rem Compile with Crystal compiler running on local linux server. | |
@echo crystal %2 -o %3 > compile.sh | |
@pscp -pw %1 -r src compile.sh %4 [email protected]:job | |
@plink -ssh [email protected] -pw %1 -m compiler.txt -t |
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
# Compile with Crystal compiler running on local Linux server. | |
require 'rake' | |
USER = "compiler" | |
IP = "192.168.0.18" | |
sh "echo crystal #{ARGV[1]} -o #{ARGV[2]} > compile.sh" | |
sh "pscp -pw #{ARGV[0]} -r src compile.sh #{ARGV[3]} #{USER}@#{IP}:job" | |
sh "plink -ssh #{USER}@#{IP} -pw #{ARGV[0]} -m compiler.txt -t" |
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
@rem Run compiled Crystal program on local linux server. | |
@echo %2 %3 %4 %5 %6 %7 > prog.sh | |
@pscp -pw %1 prog.sh [email protected]:job | |
@plink -ssh [email protected] -pw %1 -m runner.txt -t |
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
# Run compiled Crystal program on local Linux server. | |
require 'rake' | |
USER = "compiler" | |
IP = "192.168.0.18" | |
args = [] | |
for i in 1..ARGV.size do | |
args.push(ARGV[i]) | |
end | |
sh "echo #{args.join(" ")} > prog.sh" | |
sh "pscp -pw #{ARGV[0]} prog.sh #{USER}@#{IP}:job" | |
sh "plink -ssh #{USER}@#{IP} -pw #{ARGV[0]} -m runner.txt -t" |
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
sh crystal-prog.sh |
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/sh | |
# Set up Crystal compiler service environment. | |
# curl http://104.131.160.152:1337/setup-crystal.sh | sh | |
curl https://dist.crystal-lang.org/apt/setup.sh | bash | |
apt install -y crystal dos2unix git | |
git clone https://gist.github.com/61ec2fe3e95d9a1618e08e35e66c6813.git | |
cd 61ec2fe3e95d9a1618e08e35e66c6813 | |
adduser compiler | |
passwd compiler | |
mkdir /home/compiler/job | |
cp crystal-compiler.sh /home/compiler | |
cp crystal-prog.sh /home/compiler | |
chown compiler:compiler /home/compiler/crystal-compiler.sh | |
chown compiler:compiler /home/compiler/crystal-prog.sh | |
chown -R compiler:compiler /home/compiler/job |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment