Skip to content

Instantly share code, notes, and snippets.

var assignAlias = _.alias;
_.alias = function(){
/* transform arguments[0] from camel to _ */
assianAlias.apply(_, arguments);
};

i1.js

require("./i2").log("Log1");

var ollog = console.log;
console.log = function(str){
  ollog.apply(this, ["Intercepted\t",str]);
};

require("./i2").log("Log2");
#!/usr/bin/env perl6
class Text::CSV {
has $.binary = 1;
has $.file_handle = Nil;
has $.contains_header_row = 0;
has $.field_separator = ',';
has $.line_separator = "\n";
has $.field_operator = '"';
has $.escape_operator = '\\';
method parse ( Str $templ ) {
my $chopper = '^\s*(' ~ $.open ~ '[\\' ~ %.nestables{'open'} ~ '\\' ~
%.nestables{'close'} ~ '].*?' ~ $.close ~ ')\s*$';
my $template = $templ.subst(/$chopper/, "\$1", :g:m);
my $length = $template.chars;
my @templarr = $template.split('');
my @opener = $.open.split('');
my @closer = $.close.split('');
my $status = 0; # 0=in text, 1=in code
my @nodes;
#!/usr/bin/env perl6
use DBIish;
use Digest::SHA;
use JSON::Tiny;
sub buf_to_hex {
$^buf.list.fmt('%02x', '');
}
Welcome to MoarVM!
Configuring native build environment ................... OK
make: make
compile: clang -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -Weverything
link: clang -g
libs: -lm -lpthread
Configuring 3rdparty libs .............................. FAIL
6 <script>
7 var delicious = {
8 % use JSON::Tiny qw{j};
9 % my $count = 0;
10 % for my $e (@{$stash->{employers}}) {
11 % my $hash = {};
12 % for (keys $e->{_result_source}->{_columns}) {
13 % $hash->{$_} = $e->{_column_data}->{$_} || undef;
14 % }
15 %== ($count++ != 0 ? ',' : '') . $hash->{eid} . ': ' . j($hash)
#!/bin/sh
HOST=$1
PORTF=$2
PORTT=$3
echo "Scanning $HOST:$PORTF-$PORTT"
for ((PORTF; PORTT >= PORTF; PORTF++)) do
SVC=`cat /etc/services | egrep "\\s$PORTF/tcp" | awk '{print $1}'`
nc -z -w 1 -G 2 -d "$HOST" "$PORTF" || echo "[$PORTF/$SVC] Failed";
#!/usr/bin/env perl6
class REST::Server {
has $.host = '127.0.0.1';
has $.port = 8080;
has %.options is rw;
has $.debug = 1;
has Supply $!scheduler;
@tony-o
tony-o / srvr.pl6
Last active August 29, 2015 14:02
my $num = 0;
IO::Socket::Async.listen($.host,$.port,).tap(-> $connection {
my $snum = $num++;
my @chunks;
"connected #$snum".say;
my $tap := $connection.chars_supply.tap({
$_.say;
try {
$connection.send("HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 6\r\n\r\nstring");
"closing connection $snum".say if $.debug;