This file contains 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 javax.crypto.Cipher; | |
public class CheckJceUnlimited { | |
public static void main(String[] args) throws Exception { | |
int maxAesLength = Cipher.getMaxAllowedKeyLength("AES"); | |
boolean unlimited = maxAesLength > 128; | |
System.out.println("JCE unlimited strength enabled: " + unlimited); | |
} | |
} |
This file contains 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
# This is the raw code as it was at the end of the session. | |
# | |
# In retrospect, the following could be improved: | |
# * @to_see is useless, two simple nested loops would work (or maybe keep it but shuffle it) | |
# * handle throttling better (instead of a lame DELAY) | |
# * I forgot to handle the case when I pick a pair by chance! | |
# * monitor game progress to avoid losing too many points | |
require "rest_client" | |
require "json" |
This file contains 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
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7' ) | |
abstract class Cache { | |
Cache parent | |
Closure loader | |
Cache(Closure loader) { | |
this.loader = loader | |
} | |
Cache(Cache parent) { |
This file contains 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.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; | |
import com.google.common.base.Function; | |
import com.google.common.util.concurrent.*; | |
public class ListenableFuturesTest { | |
public static void main(String[] args) throws Exception { | |
ListeningScheduledExecutorService completer = MoreExecutors.listeningDecorator( | |
Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder().setNameFormat("completer").build())); |
This file contains 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
static void reportInFlightQueries(Session session) { | |
Session.State state = session.getState(); | |
System.out.printf("State of %s:%n", session); | |
for (Host host : state.getConnectedHosts()) { | |
int connections = state.getOpenConnections(host); | |
int inFlight = state.getInFlightQueries(host); | |
System.out.printf("\t%s:\tconnections=%2s\tinFlight=%4s\tmean=%4s%n", | |
host, | |
connections, | |
inFlight, |
This file contains 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.util.concurrent.Semaphore; | |
import java.util.concurrent.TimeUnit; | |
import com.codahale.metrics.ConsoleReporter; | |
import com.google.common.collect.ImmutableMap; | |
import com.google.common.util.concurrent.MoreExecutors; | |
import org.junit.ClassRule; | |
import org.junit.Rule; | |
import org.junit.Test; | |
import org.scassandra.http.client.PrimingClient; |
This file contains 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
package com.datastax.driver.core; | |
import java.awt.Component; | |
import java.awt.Container; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.util.Iterator; | |
import java.util.Set; | |
import javax.swing.*; |
This file contains 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
/* Basic j.u.l config for simple projects */ | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
public class Jul{ | |
static { | |
Logger.getLogger("").setLevel(Level.SEVERE); | |
final Logger myLogger = Logger.getLogger("com.mycompany"); | |
myLogger.setLevel(Level.FINEST); |
This file contains 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.util.Calendar._ | |
import java.util.GregorianCalendar | |
import java.util.GregorianCalendar._ | |
import java.util.TimeZone | |
// A calendar in Paris' time zone (GMT+1) | |
val cfr = new GregorianCalendar | |
cfr.setTimeZone(TimeZone.getTimeZone("Europe/Paris")) | |
// A calendar at GMT+0 |
This file contains 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
/* | |
* Copyright (c) 2010, Olivier Michallat | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without modification, | |
* are permitted provided that the following conditions are met: | |
* | |
* 1. Redistributions of source code must retain the above copyright notice, this | |
* list of conditions and the following disclaimer. | |
* 2. Redistributions in binary form must reproduce the above copyright notice, |
OlderNewer