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
xdef distance(a, b) | |
return a.length if (0 == b.length) | |
return b.length if (0 == a.length) | |
unpack_rule = ($KCODE =~ /^U/i) ? 'U*' : 'C*' | |
mapper = lambda{|str| | |
str = str.unpack(unpack_rule) | |
map = [] | |
str.each_with_index {|letter,idx| |
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
# placeholder for domains to ssh into. |
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
require 'rrobots' | |
class Elorest | |
include Robot | |
def tick events | |
@time = "hello" if time == 0 | |
say @time | |
# @planned ||= events['robot_scanned'].inspect | |
# say @planned |
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
require "socket" | |
UNIXSocket.open("/tmp/cr.sock") do |sock| | |
puts "What is your name?" | |
name = gets | |
sock.puts name | |
puts sock.gets | |
sock.close | |
end |
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
#include <stdio.h> | |
struct Person{ | |
char * name; | |
char * height; | |
int age; | |
}; | |
void hello_ptr(const struct Person * p){ |
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
@[Link(ldflags: "#{__DIR__}/say.o")] | |
@[Link("m")] | |
lib LibSay | |
struct Person | |
name : UInt8* | |
height : UInt8* | |
age : Int32 | |
end |
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
{% `gcc -c say.c` %} # Uses macro to compile object file before compile time. | |
@[Link(ldflags: "#{__DIR__}/say.o")] | |
@[Link("m")] | |
lib LibSay | |
struct Person | |
name : UInt8* | |
height : UInt8* | |
age : Int32 | |
end |
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
require "socket" | |
UNIXSocket.open("/tmp/cr.sock") do |sock| | |
puts "What is your name?" | |
name = gets | |
sock.puts name | |
puts sock.gets | |
sock.close | |
end |
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
@[Link(ldflags: "#{__DIR__}/say.o")] | |
@[Link("m")] | |
lib LibSay | |
struct Person | |
name : UInt8* | |
height : UInt8* | |
age : Int32 | |
end |
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
macro parse_yaml(filename) | |
{{ run("./yamlparser.cr", filename) }} | |
end | |
parse_yaml("tmp.yml") | |
puts dev["array"] | |
puts prod["array"] |
OlderNewer