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
| (function() { | |
| var NARWHAL_HOME = Packages.java.lang.System.getenv("NARWHAL_HOME"); | |
| var JSPATH = Packages.java.lang.System.getenv("JSPATH"); | |
| var NARWHALPATH = Packages.java.lang.System.getenv("NARWHALPATH"); | |
| $LOAD_PATH = NARWHAL_HOME + "/lib/platforms/rhino:" + NARWHAL_HOME + "/lib"; | |
| if (JSPATH) $LOAD_PATH += ":" + JSPATH; | |
| if (NARWHALPATH) $LOAD_PATH += ":" + NARWHALPATH; |
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
| from StringIO import StringIO | |
| buffer = StringIO() | |
| buffer.write('Hello,') | |
| buffer.write(' ') | |
| buffer.write('World!') | |
| assert buffer.getvalue() == 'Hello, World!' | |
| buffer = StringIO(buffer.getvalue()) | |
| assert buffer.read(7) == "Hello, " | |
| assert buffer.read() == "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
| var base = require('chiron/base'); | |
| var sandbox = require('chiron/sandbox').sandbox; | |
| base.forEach([ | |
| 'absolute', | |
| 'cyclic', | |
| 'exactExports', | |
| 'hasOwnProperty', | |
| 'method', |
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
| var sandboxing = require('chiron/sandbox'); | |
| var sandbox = sandboxing.sandbox; | |
| var base = require('chiron/base'); | |
| var mime = require('chiron/mime'); | |
| exports.main = function (env) { | |
| var log = base.List(); | |
| var environment = {'print': log.push}; | |
| environment.print = log.push; |
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
| function git-branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/' | |
| } | |
| PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(git-branch)\[\033[00m\] \$ ' | |
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
| # apt-get install curl | |
| read -p 'login: ' USER | |
| read -s -p 'password: ' PASSWORD | |
| curl --silent -b twitter-cookie.txt -c twitter-cookie.txt \ | |
| --user-agent Mozilla/4.0 \ | |
| -d username_or_email="$USER" \ | |
| -d password="$PASSWORD" \ | |
| -d 'commit=Sign In' \ |
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
| http://dict.tu-chemnitz.de/dings.cgi?query=%s&lang=en&service=deen&opterrors=0&optpro=0&iservice=&comment=&email=&mozcharset=iso-8859-1 | |
| # in Firefox, add a bookmark with this location, and set the keyword to "de" or something. | |
| # At the location bar, type "de könig". Observe that the umlaut gets encoded properly, | |
| # instead of the UTF-8 default. &mozcharset= is a FF workaround for setting the charset. |
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
| exports.NarwhalParser = type([args.Parser], function (self, supr) { | |
| self.option('-h', '--help') | |
| .help('displays help') | |
| .action(function () { | |
| }); | |
| }); | |
| exports.ObjjParser = type([exports.NarwhalParser], function (self, supr) { |
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
| # generate crazy mixed version, and sort them dewey decimal | |
| echo {11,1}.{11,1}.{11,1}.{11,1} | xargs -n 1 \ | |
| | awk 'BEGIN{FS="."}{print $4, $1, $2, $3}' \ | |
| | sort -ns \ | |
| | awk '{print $4, $1, $2, $3}' \ | |
| | sort -ns \ | |
| | awk '{print $4, $1, $2, $3}' \ | |
| | sort -ns \ | |
| | awk '{print $4, $1, $2, $3}' \ | |
| | sort -ns \ |
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
| var jna = Packages.com.sun.jna; | |
| var clib = jna.NativeLibrary.getInstance(jna.Platform.isWindows() ? "msvcrt" : "c"); | |
| var csystem = clib.getFunction("system"); | |
| csystem.invoke(["echo Hello, World!"]); |
OlderNewer