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
try | |
{ | |
import C.stdio.*; | |
import flash.utils.ByteArray; | |
function write( message:String = "" ):void | |
{ | |
var bytes:ByteArray = new ByteArray(); | |
bytes.writeUTFBytes( message ); |
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
#!/usr/bin/as3shebang -- | |
/* Note: | |
Again the joy of using POSIX from AS3 :p | |
see: | |
Copy a file in an sane, safe and efficient way | |
http://stackoverflow.com/questions/10195343/copy-a-file-in-an-sane-safe-and-efficient-way | |
BUFSIZ |
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
#!/usr/bin/as3shebang -- | |
// see http://en.wikipedia.org/wiki/ANSI_escape_code | |
package ansi | |
{ | |
import flash.utils.describeType; | |
import shell.Program; | |
public class controls | |
{ |
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
#!/usr/bin/as3shebang -- | |
/* Note: | |
mkdir() creates directoy | |
but can not creates directory tree | |
the command line "$ mkdir -p" allows that | |
so here a small util function to emulate that | |
behaviour | |
*/ |
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
#!/usr/bin/as3shebang -- | |
import C.stdlib.*; // getenv, exit, EXIT_SUCCESS, EXIT_FAILURE | |
import C.unistd.*; // access, X_OK, getlogin | |
import C.sys.stat.*; // stat, status, S_ISREG, S_IXUSR, S_IXGRP, S_IXOTH | |
/* NOTE: | |
Inside Bash scripts you often encounter | |
svn = ${`which svn`} | |
to get the full path of an executable |
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
#!/usr/bin/as3shebang -- | |
import flash.utils.*; | |
import shell.*; | |
import C.stdlib.*; | |
/* NOTE: | |
how to embed binaries in plain text | |
in our case how to embed ABC libraries in shell scripts |
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
#!/usr/bin/as3shebang -- | |
import flash.utils.*; | |
import shell.*; | |
function ansilib():* | |
{ | |
var hex:String = "10002e00000000990100054172726179066c656e6774680c616e73696c69622e617324310d656e636f"; | |
hex += "64696e672e616e736921687474703a2f2f61646f62652e636f6d2f4153332f323030362f6275696c74"; | |
hex += "696e05726573657406537472696e6716656e636f64696e672e616e73693a636f6e74726f6c73041b5b"; |
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
#!/usr/bin/as3shebang -- | |
import C.errno.*; // errno CError | |
import C.stdlib.*; // exit EXIT_SUCCESS EXIT_FAILURE system | |
import C.stdio.*; // remove | |
import C.unistd.*; // access F_OK | |
import C.sys.stat.*; | |
import shell.*; |
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
#!/usr/bin/as3shebang -- | |
import shell.Program; | |
import shell.Runtime; | |
import flash.events.TimerEvent; | |
import flash.utils.Timer; | |
Program.atExit( function() { trace( "I'm out" ); } ); |
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
#!/usr/bin/as3shebang -- | |
import C.stdlib.*; // exit | |
import C.unistd.*; // sleep | |
var i:uint = 0; | |
function show():void | |
{ | |
trace( "hello", i ); | |
i++; |