Skip to content

Instantly share code, notes, and snippets.

* Version 3.0.1 (unreleased)
** Fix JSONDict not pickling.
* Version 3.0.0 (released 2014-10-09)
** Complete API rewrite to simplify library significantly.
* Version 2.0.0 (released 2014-09-26)
** Updated to the latest U2F_V2 standard.
** Expose more low level U2F primitives.
** Removed old draft versions.
# /etc/X11/Xsession.d/90gpg-agent
: ${GNUPGHOME=$HOME/.gnupg}
GPGAGENT=/usr/bin/gpg-agent
# Original, not working: PID_FILE="$GNUPGHOME/gpg-agent-info-$(hostname)"
PID_FILE="$GNUPGHOME/gpg-agent-info"
if grep -qs '^[[:space:]]*use-agent' "$GNUPGHOME/gpg.conf" "$GNUPGHOME/options" &&
package com.smartbear.saas.rs.model;
import com.google.common.collect.ImmutableSet;
import org.junit.Test;
import java.util.Set;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.*;
package com.smartbear.saas.rs.storage;
import com.github.fakemongo.Fongo;
import com.mongodb.util.JSONSerializers;
import org.jongo.Jongo;
import org.jongo.MongoCollection;
import org.junit.Test;
import static java.util.stream.Collectors.joining;
class TestRunResource
{
private final TestQueue testQueue;
private final TestStorage testStorage;
public void stopTestRun( @Auth User user, @PathParam( "id" ) String testId )
{
TestRun test = getTestRun( user, testId ); // gets testrun from testStorage
testQueue.abort( test );
test.abort();
/*
* When a Task is aborted, it should b aborted in the taskQueue and its state should be
* persisted to taskStorage. There is also a start method with similar requirements.
*
* Below are different implementation alternatives for a REST method.
*/
// Alt. 1 -- Task knows about taskStorage and taskQueue:
taskStorage.getTask( id ).abort().save();
/////////////////////// There's an infitite loop hidden in this code ////////////////////////////
class Foo
{
private final HashMap<String, Integer> scores = new HashMap<>();
synchronized resetCount( String name )
{
scores.put( name, 0 );
}
class RequestRunnerExecutor
{
private final Set<HttpWebResponse> runningRequests = new HashSet<>();
public ListenableFuture<Boolean> runRequest( URI uri )
{
final Future<HttpWebResponse> futureResponse = httpClient.execute(
HttpAsyncMethods.createGet( uri ),
new ByteConsumer(),
new ResponseCallback()
class Foo {
private Helper helper = null;
public Helper getHelper() {
if (helper == null) {
synchronized (this) {
if (helper == null) {
helper = new Helper();
}
}
class Foo {
private Helper helper = null;
public Helper synchronized getHelper() {
if (helper == null)
helper = new Helper();
return helper;
}
}