Skip to content

Instantly share code, notes, and snippets.

View rantav's full-sized avatar
🎯
Focusing

Ran Tavory rantav

🎯
Focusing
View GitHub Profile
/**
* Test insertion of a supercolumn using insert
*/
@Test
public void testInsertSuper() throws IllegalArgumentException, NoSuchElementException,
IllegalStateException, NotFoundException, Exception {
// insert value
ColumnPath cp = new ColumnPath("Super1");
cp.setColumn(bytes("testInsertSuper_column"));
@rantav
rantav / gist:626051
Created October 14, 2010 11:25
mvn snippet to create an rpm for tomcat war
<pluginManagement>
<plugins>
<!--
The RPM plugin is used to create distributable apps from our war file.
To use it fire:
$ mvn install rpm:rpm
...
The resulting rpm is then found at Project/target/rpm/Project/RPMS/noarch/Project-versoin-1.noarch.rpm
For example: ImageServer/target/rpm/ImageServer/RPMS/noarch/ImageServer-6.5.0-1.noarch.rpm
function f(x) {
x = 5;
}
@rantav
rantav / gist:755981
Created December 27, 2010 09:15
Send a curl request to update glu's desired model
$ curl -D - -d '{"entries": [],"fabric": "glu-dev-1"}' -H "Content-Type: text/json" http://glua:password@glu:8080/console/rest/v1/glu-dev-1/system/model
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=372A5EC836E06F574BB301AB9902C720; Path=/console
Set-Cookie: rememberMe=deleteMe; Path=/console; Expires=Sun, 26-Dec-2010 09:11:28 GMT
Set-Cookie: fabric=Kqs9Bg72Lg1z; Expires=Tue, 27-Dec-2011 09:11:29 GMT; Path=/console
Set-Cookie: product=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/console
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
@rantav
rantav / GluProxy.java
Created December 27, 2010 19:40
Sending a model to glu in java
package com.outbrain.glu;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
@rantav
rantav / gist:759549
Created December 30, 2010 07:16
Glu: upload a model, then create an execution plan, then execute it
######################################################
# Define a system model (fill in the entries array with your model.
######################################################
$ curl -D - -u glua:password -d '{"entries": [],"fabric": "glu-dev-1"}' -H "Content-Type: text/json" http://localhost:8080/console/rest/v1/glu-dev-1/system/model
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=E68FFC0F95FA944FBCCA83A62F922B6E; Path=/console
Set-Cookie: rememberMe=deleteMe; Path=/console; Expires=Wed, 29-Dec-2010 07:09:52 GMT
Set-Cookie: fabric=Kqs9Bg72Lg1z; Expires=Fri, 30-Dec-2011 07:09:52 GMT; Path=/console
@rantav
rantav / post-commit
Created February 4, 2011 06:59
Post commit hook at outbrain used for Continuous Deployment
#!/bin/sh
# POST-COMMIT HOOK
#
# The post-commit hook is invoked after a commit. Subversion runs
# this hook by invoking a program (script, executable, binary, etc.)
# named 'post-commit' (for which this file is a template) with the
# following ordered arguments:
#
# [1] REPOS-PATH (the path to this repository)
@rantav
rantav / addNotableGroceryStores-heroku-console.rb
Created March 31, 2011 12:05
Finding the "I'm feeling Ducky" URL for a search term - rails console style
# To run this:
# $ heroku console.
# >> Paste this long line
# condensed in one line for heroku's console; yuk
g = JSON.parse(IO.read('NotableGroceryStores.json')); g['map'].each { |k,v|; puts k; r = Net::HTTP.get 'api.duckduckgo.com', "/?q=#{URI.escape(k)}&o=json"; j = JSON.parse(r); url = nil; url = j['Results'][0]['FirstURL'] if j and j['Results'] and j['Results'][0]; StoreChain.create(:name => k, :url => url) and puts url}
@rantav
rantav / .gitconfig
Created May 6, 2011 10:29
My .gitconfig
# Many goodies from here and all around http://stackoverflow.com/questions/267761/what-does-your-gitconfig-contain
[user]
name = Your Name
email = your@email.com
[color]
diff = auto
status = auto
branch = auto
@rantav
rantav / agent's log
Created May 23, 2011 10:52
outbrain's glu script
2011/05/23 03:45:22.330 WARN [/CrawlerSpawn/i001] Exception while running monitor: Can't get http://hostname.../selftest?format=text to /outbrain/glu/org.linkedin.glu.packaging-all-1.5.1/org.linkedin.glu.agent-server-1.5.1/data/tmp/CrawlerSpawn/i001/__tmp1708500738Dir/selftest
2011/05/23 03:45:22.331 WARN [/CrawlerSpawn/i001] Self test failed => forcing new state stopped
2011/05/23 03:45:23.886 WARN [BaseResource] unexpected error while processing request
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Throwable
at org.linkedin.groovy.util.state.StateMachineImpl$_waitForState_closure13.doCall(StateMachineImpl.groovy:308)
at sun.reflect.GeneratedMethodAccessor15011.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
at groovy.lang.MetaMethod.doMethodIn