mirror of
https://github.com/narkoz/hacker-scripts
synced 2025-08-22 10:27:11 +00:00
Run script from bash
This commit is contained in:
parent
7d11758390
commit
895b9228d3
@ -1,17 +1,18 @@
|
||||
/*******************************************
|
||||
*
|
||||
* Get and run Ammonite (http://lihaoyi.github.io/Ammonite/#Ammonite-Shell):
|
||||
* Get Ammonite (http://lihaoyi.github.io/Ammonite/#Ammonite-Shell):
|
||||
* $ mkdir ~/.ammonite; curl -L -o ~/.ammonite/predef.scala http://git.io/vR04f
|
||||
* $ curl -L -o amm http://git.io/vR08A; chmod +x amm; ./amm
|
||||
* $ curl -L -o amm http://git.io/vR08A; chmod +x amm
|
||||
*
|
||||
* Run script:
|
||||
* @ load.exec("fucking-coffee.scala")
|
||||
* Run script
|
||||
* $ ./amm fucking-coffee.scala
|
||||
*
|
||||
*******************************************/
|
||||
|
||||
import java.net._
|
||||
import java.io._
|
||||
import ammonite.ops._
|
||||
import ammonite.ops.ImplicitWd._
|
||||
|
||||
val coffeeMachineIP = "10.10.42.42"
|
||||
val password = "1234"
|
||||
@ -25,6 +26,7 @@ if ((%%who "-q").out.string.contains(sys.props("user.name"))) {
|
||||
val out = new PrintWriter(telnet.getOutputStream, true)
|
||||
val in = new BufferedReader(new InputStreamReader(telnet.getInputStream))
|
||||
|
||||
println(s"Wait for $delayBeforeBrew seconds")
|
||||
Thread.sleep(delayBeforeBrew * 1000);
|
||||
|
||||
if(in.readLine == passwordPrompt){
|
||||
|
Loading…
x
Reference in New Issue
Block a user