Skip to content

Instantly share code, notes, and snippets.

View zwetan's full-sized avatar
🌀
getting shit done

Zwetan Kjukov zwetan

🌀
getting shit done
View GitHub Profile
@ECHO OFF
REM -- Redtamarin Windows Environment Setup
REM -- This will install the following:
REM -- 1) Cygwin
REM -- https://cygwin.com/
REM -- 2) Cygwin Packages
REM -- bash,bash-completion,mintty,ncurses,which,
REM -- nano,wget,hostname,openssh
REM -- 3) apt-cyg - Cygwin Package Manager
REM -- https://github.com/transcode-open/apt-cyg
@zwetan
zwetan / redbean
Created September 13, 2015 10:27
redbean bash script to place in the redtamarin-sdk bin folder (rename original redbean binary to "redbean-macintosh" for ex)
#!/bin/bash
function follow_links() {
file="$1"
while [ -h "$file" ]; do
# On Mac OS, readlink -f doesn't work.
file="$(readlink "$file")"
done
echo "$file"
}
@zwetan
zwetan / redshell
Created September 13, 2015 10:10
redshell bash script to place in the redtamarin-sdk bin folder
#!/bin/bash
function follow_links() {
file="$1"
while [ -h "$file" ]; do
# On Mac OS, readlink -f doesn't work.
file="$(readlink "$file")"
done
echo "$file"
}
@zwetan
zwetan / HttpRequest.as
Created June 19, 2015 11:37
nodeas replica
package nodeas.http
{
public class HttpRequest
{
private var _request:String;
public function HttpRequest():void
{
super();
@zwetan
zwetan / test_delay.as
Created May 29, 2015 03:42
a basic "forever loop"
#!/usr/bin/as3shebang --
import C.stdlib.*; // exit
import C.unistd.*; // sleep
var i:uint = 0;
function show():void
{
trace( "hello", i );
i++;
@zwetan
zwetan / test_async.as
Created May 29, 2015 03:33
async, event and timers in redtamarin -- alpha quality
#!/usr/bin/as3shebang --
import shell.Program;
import shell.Runtime;
import flash.events.TimerEvent;
import flash.utils.Timer;
Program.atExit( function() { trace( "I'm out" ); } );
@zwetan
zwetan / pdf2png.as
Last active August 29, 2015 14:21
build a simple command line tool with as3shebang : a pdf to png converter
#!/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.*;
@zwetan
zwetan / test_binembed.as
Created May 10, 2015 14:13
how to embed an ABC library as string into a shell script
#!/usr/bin/as3shebang --
import flash.utils.*;
import shell.*;
function ansilib():*
{
var hex:String = "10002e00000000990100054172726179066c656e6774680c616e73696c69622e617324310d656e636f";
hex += "64696e672e616e736921687474703a2f2f61646f62652e636f6d2f4153332f323030362f6275696c74";
hex += "696e05726573657406537472696e6716656e636f64696e672e616e73693a636f6e74726f6c73041b5b";
#!/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
@zwetan
zwetan / test_which.as
Created May 10, 2015 08:55
implementation of the shell utility "which"
#!/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