Skip to content

Instantly share code, notes, and snippets.

View jmesnil's full-sized avatar

Jeff Mesnil jmesnil

View GitHub Profile
public class AppleScriptTest {
public static void main(String[] args) throws Exception {
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("AppleScript");
engine.eval("tell application \"Finder\"\n display dialog \"Who cares?\"\n end tell");
}
}
@jmesnil
jmesnil / ScriptTest.java
Created July 25, 2008 12:07
How to execute JavaScript code from a Java class
public class JavaScriptTest {
public static void main(String[] args) throws Exception {
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
engine.eval("print('hello, world!')");
}
}

Keybase proof

I hereby claim:

  • I am jmesnil on github.
  • I am jmesnil (https://keybase.io/jmesnil) on keybase.
  • I have a public key whose fingerprint is 8D95 D465 4C59 3255 F67C 8730 5844 B804 4669 A197

To claim this, I am signing this object:

cd ~/Work
# retrieve the latest version of git
git clone git://git.kernel.org/pub/scm/git/git.git
cd git/
make GITWEB_PROJECTROOT="/Users/jmesnil/Work/" \
GITWEB_CSS="/gitweb/gitweb.css" \
GITWEB_LOGO="/gitweb/git-logo.png" \
GITWEB_FAVICON="/gitweb/git-favicon.png" \
bindir=/opt/local/bin
gitweb/gitweb.cgi
#!/usr/bin/env jruby
require 'rubygems'
require 'jmx4r'
runtime = JMX::MBean.find_by_name "java.lang:type=Runtime"
# runtime.system_properties is a TabularData
runtime.system_properties.each do | sysprop |
puts "#{sysprop["key"]} = #{sysprop["value"]}"
end
#!/usr/bin/env jruby
require 'rubygems'
require 'jmx4r'
require 'jconsole'
mem_pools = JMX::MBean.find_all_by_name "java.lang:type=MemoryPool,*"
mem_pools.each do |pool|
# print the 'name' property of the pool's ObjectName
puts pool.object_name["name"]
end
for i in {1..100}
do
echo $i
ant -Dtest-mask=JMSServerControl2Test integration-tests
if [ $? != 0 ] ; then
break
fi
done
(defn verify-challenge
[callback mode topic challenge]
(let [url (build-callback-url callback mode topic challenge)]
(try
(= challenge (.trim (apply str (:body-seq (request url))))) 204
(catch Exception ex (failed-challenge callback (.getMessage ex))))))
RESP_FILE=/tmp/gist.tmp
rm -f $RESP_FILE
USER=`git config --global github.user`
USERAVAIL=$?
TOKEN=`git config --global github.token`
TOKENAVAIL=$?
if [ $USERAVAIL -eq 0 -a $TOKENAVAIL -eq 0 ]; then
AUTH="--data-urlencode login=$USER --data-urlencode token=$TOKEN"
fi
(defn verify-subscriber [callback sync mode topic challenge]
(debug callback sync mode topic challenge)
(if sync
(verify-challenge callback mode topic challenge)
202))