Skip to content

Instantly share code, notes, and snippets.

import java.io.*;
public class JavaSystemCalls {
public static void main(String args[]) {
String s = null;
try {
puts "give me a command (q to quit):"
STDOUT.flush
while(input = gets)
break if input.strip == 'q'
puts `#{input}`
puts "give me a command:"
STDOUT.flush
end
@jaydonnell
jaydonnell / gist:882081
Created March 22, 2011 21:13
using ant and ivy from rake with jruby
require 'ant'
def ivy_retrieve(org, mod, rev)
ant.retrieve :organisation => org,
:module => mod,
:revision => rev,
:pattern => 'javalib/[conf]/[artifact].[ext]',
:inline => true
end
# an example for setting the classpath in a custom buildr task
task :threadingtest => [:compile, :test] do
# this will give us the project dependencies
specs = (project.compile.dependencies + project.test.compile.dependencies).flatten
# this turns them into the proper string representation
cp = Buildr.artifacts(specs).each(&:invoke).map(&:name).join(File::PATH_SEPARATOR)
# last we need to add our compiled classes
cp = cp + ":" + path_to('target', 'classes') + ":" + path_to('target', 'test', 'classes')
cmd = "java -cp #{cp} org.junit.runner.JUnitCore com.jaydonnell.javautils.MultiThreadedIT"
(defn send-url [url]
(try
(let [ip (ru/ip-address (get-domain url))]
(log/debug (str "SENDING URL: " url))
(if (@fetchers ip)
(send-off (@fetchers ip)
handle-url
url)
(do
(add-fetcher ip)
public class ThreadedTest {
private static boolean ready;
private static int number;
private static class ReaderThread extends Thread {
public void run() {
while (!ready)
Thread.yield();
System.out.println(number);
}
}
diff --git a/vendor/plugins/haml/init.rb b/vendor/plugins/haml/init.rb
index 3b64a9e..7cd9a05 100644
--- a/vendor/plugins/haml/init.rb
+++ b/vendor/plugins/haml/init.rb
@@ -1,18 +1,8 @@
begin
require File.join(File.dirname(__FILE__), 'lib', 'haml') # From here
rescue LoadError
- begin
- require 'haml' # From gem
rbx 1.0
-------
danny-donnells-iMac:ranka ddonnell$ rvm use rbx
Using rbx 1.0.0 20100514
danny-donnells-iMac:ranka ddonnell$ ruby cli.rb
user system total real
ranka: 4.862326 0.000000 4.862326 ( 4.862317)
danny-donnells-iMac:ranka ddonnell$ ruby cli.rb
user system total real
ranka: 4.855770 0.000000 4.855770 ( 4.855766)
require 'magic_xml'
require 'trollop'
require 'open-uri'
require 'forkoff'
# Installation:
#
# gem install magic_xml trollop forkoff
#
# Get your delicious bookmark backup with:
$("mvn exec:exec -Dexec.args=\"jar $JOB_JAR com.attinteractive.hadoopjobs.searchtools.stage1.Stage1 $1 $2\"")