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
!/bin/bash | |
# kill currently running java process | |
echo "Java processes: $(pgrep java)" | |
pkill -9 java | |
for i in $(seq 1 20) | |
do | |
sleep 1 | |
pgrep java || exit |
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
InputStream stream = new BufferedInputStream(response.getResponseBodyAsStream()); | |
JsonParser parser = new MappingJsonFactory(Jacksons.JSON_OBJECT_MAPPER).createJsonParser(stream); | |
parser.disableFeature(JsonParser.Feature.AUTO_CLOSE_SOURCE); | |
JacksonIterator<String> iter = JacksonIterator.iterator(parser, String.class, "items"); |
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 'cassandra' | |
blog = Cassandra.new('Multiblog') | |
blog.insert(:Blogs, 'david', { UUID.new => 'eventdata' }) | |
blog.insert(:Blogs, 'david', { UUID.new => 'eventdata2' }) | |
... | |
blog.insert(:Blogs, 'david', { UUID.new => 'eventdata9' }) | |
blog.get(:Blogs, "david", :count => 3, :reversed => true).values |
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
import java.nio.charset.Charset; | |
import java.text.SimpleDateFormat; | |
import java.util.Arrays; | |
import java.util.Date; | |
import java.util.TimeZone; | |
public class FastDateFormatter | |
{ | |
private static final byte[][] DATES = new byte[24837][]; // days in [1970, 2038) | |
private static final byte[] DIGITS = toUtf8("0123456789"); |
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> | |
#include <GeoIPCity.h> | |
int main(int argc, char *argv[]) | |
{ | |
GeoIP *geo; | |
char buf[32768]; | |
char addr[16]; | |
unsigned int ip1, ip2, ip3, ip4; | |
GeoIPRecord *rec; |
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> | |
#include <GeoIPCity.h> | |
int main(int argc, char *argv[]) | |
{ | |
GeoIP *geo; | |
char buf[32768]; | |
unsigned long ip; | |
GeoIPRecord *rec; |
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
public class NewlinePrettyPrinter implements PrettyPrinter | |
{ | |
@Override | |
public void writeRootValueSeparator(JsonGenerator jg) throws IOException | |
{ | |
jg.writeRaw('\n'); | |
} | |
@Override | |
public void writeStartObject(JsonGenerator jg) throws IOException |
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
import org.apache.commons.logging.LogFactory; | |
@SuppressWarnings({"UnusedDeclaration"}) | |
public class Log | |
{ | |
private final org.apache.commons.logging.Log log; | |
private Log(String name) | |
{ | |
log = LogFactory.getLog(name); |
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
#!/bin/sh | |
exec sed -i '' 's/[[:space:]]*$//' "$@" |
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
Hash.new {|h,k| h[k] = [] } |
OlderNewer