This file contains 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
class PipeElement | |
attr_accessor :source | |
def initialize | |
@delegator = Fiber.new do | |
process | |
end | |
end | |
def | other |
This file contains 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
defmodule Registry1 do | |
use ExActor.GenServer | |
definit do: initial_state(HashDict.new) | |
defcast create(name), state: names, do: put_name(names,name) | |
defcall lookup(name), state: names, do: reply(HashDict.fetch(names,name)) | |
def put_name(names, name) do |
This file contains 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
class Member: | |
def __init__(self,name='',group=''): | |
self.name = name | |
self.group = group | |
class Team: | |
def __init__(self, names): | |
self.members = [Member(n,str(hash(self))) for n in names] | |
def join_us(self,member=Member()): | |
self.members.append(member) |
This file contains 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/env escript | |
main(_Args) -> | |
Y = fun(Generator) -> | |
Gen = fun(X) -> | |
fun(Args) -> | |
(Generator(X(X)))(Args) | |
end | |
end, | |
Gen(Gen) |
This file contains 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
import time,sys,os | |
# usage: | |
# ssh localhost 'python <this_file>' | |
def test(): | |
j = True | |
while j: | |
time.sleep(1) | |
print("Hello:"+str(j)) | |
print "Bye" |
This file contains 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
-module(ssh_test). | |
-export([go/0]). | |
go() -> | |
ssh:start(), | |
Host = "127.0.0.1", | |
Port = 22, | |
Options = [{user,"john"}, | |
{silently_accept_hosts, true}, | |
{user_interaction, false}, |
This file contains 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
*.swp | |
*.beam |
This file contains 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/env python | |
def dec(fn): | |
def inner_fn(*args): | |
result = fn(*args) | |
print "the result is: " + result | |
return result | |
return inner_fn |
This file contains 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
-module(ipctest). | |
-export([oneway/0, consumer/0, pingpong/0]). | |
oneway() -> | |
N = 10000000, | |
Pid = spawn(ipctest, consumer, []), | |
Start = erlang:now(), | |
dotimes(N - 1, fun () -> Pid ! message end), | |
Pid ! {done, self()}, | |
receive ok -> ok end, |
This file contains 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
public class Misc { | |
public static int[] StrToInt(String str) { | |
if(str == null) return new int[0]; | |
int[] array = new int[str.codePointCount(0,str.length())]; | |
for(int i=0; i < array.length; i++){ | |
array[i] = str.codePointAt(i); | |
} | |
return array; | |
} | |
} |
NewerOlder