News for hackers. Stuff that matters.
Re:Ruby inline assembler by nathell on Friday January 11, 2013 @10:14AM (#5042975)
Re:Ruby inline assembler by api on Friday January 11, 2013 @09:17AM (#5042729)
This is like putting NOS on a school bus.
Re:Ruby inline assembler by JonnieCache on Friday January 11, 2013 @12:15PM (#5043651)
That's ironic because it was written on a bus.

See the following rubycon talk, "worst idea ever!" which covers this and several other even more horrendously ill-advised gems:

http://www.confreaks.com/videos/198-rubyconf2009-worst-ideas...

It includes a way to rescue from segfaults, which goes quite nicely with the inline assembly :)

If you are a rubyist you should watch this. It's hilarious. If you think this wilson gem is crazy wait until you see the other shit they get up to.

Re:Ruby inline assembler by kgo on Friday January 11, 2013 @04:36PM (#5045190)
I wrote a similar thing a while ago for python:

http://www.grant-olson.net/python/pyasm

It even mapped all the exported symbols from the python API so you could do stuff like:

    CALL PySys_WriteStdout "Hello, World!\n\0"
About every three months I get an email from someone where I have to explain it was a proof-of-concept and never intended for production use.
Re:Ruby inline assembler by jbarnette on Friday January 11, 2013 @11:34AM (#5043386)
My favorite thing about this library is that it parses the NASM manual: https://github.com/seattlerb/wilson/blob/master/lib/wilson.r...
Re:Ruby inline assembler by donavanm on Friday January 11, 2013 @12:34PM (#5043790)
You guys do understand this is a joke, right? It's a (cool) example of stupid things that you can get up to in ruby. See the ruby con talk for other examples. Enterprise Ruby is my personal favorite.
Re:Ruby inline assembler by tzumby on Friday January 11, 2013 @12:55PM (#5043929)
The rdoc for enterprise ruby is hilarious (https://github.com/tenderlove/enterprise#synopsis)

"Let’s convert that crappy ruby code to XML"

Re:Ruby inline assembler by jrabone on Friday January 11, 2013 @02:15PM (#5044398)
I don't think the community should be laughing too loudly about enterprise XML, given the security difficulties Rails has been having with its serialisation formats. How much did people lose in that Bitcoin exchange hack?
Re:Ruby inline assembler by donavanm on Saturday January 12, 2013 @03:11AM (#5046945)
Approximately 1 hojillion[1] dollars? But I think we both know that's not the real question here. Not to dissect the frog too much, but the joke is that XML == Enterprise === Grown Up. Therefore more XML is mo betta.

[1] www.penny-arcade.com/comic/2001/6/22

Re:Ruby inline assembler by drv on Friday January 11, 2013 @03:26PM (#5044783)
Pretty neat hack.

However, it's a bit odd that it parses the intended-for-humans NASM documentation instead of the machine-readable insns.dat that NASM actually uses to generate opcodes: http://repo.or.cz/w/nasm.git/blob/HEAD:/insns.dat

Re:Ruby inline assembler by helper on Friday January 11, 2013 @11:31AM (#5043366)
Cool. Looks similar to ronin: https://github.com/ronin-ruby/ronin-asm.

I'm curious if there are equivalent tools for doing this sort of thing for other cpu families. Specifically, what do people use for MIPS and ARM architectures?

Re:Ruby inline assembler by sokrates on Friday January 11, 2013 @03:14PM (#5044712)
What's different (from a quick look at ronin) is that this actually runs the assembled code within the currently running ruby interpreter. That's a lot more than a DSL for creating assembly.
Re:Ruby inline assembler by artellectual on Friday January 11, 2013 @10:41AM (#5043102)
Hats off to you! This is simply amazing!
Re:Ruby inline assembler by lawl on Friday January 11, 2013 @10:52AM (#5043155)
I didn't write it. I just found it. Maybe should have mentioned that. But I thought it was clear. Sorry.