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 MyServiceImpl extends DeviceServiceGrpc.DeviceServiceImplBase { | |
@Override | |
public StreamObserver<GetLocationRequest> getLocations(StreamObserver<GetLocationResponse> responseObserver) { | |
RequestBridge<GetLocationRequest> request = new RequestBridge<>(); | |
ResponseBridge response = new ResponseBridge((ServerCallStreamObserver) responseObserver); | |
request.map(this::doGetLocation) | |
.subscribe(response); | |
return request; | |
} |
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 TriggerStep extends AbstractStepImpl { | |
private final String spec; | |
@DataBoundConstructor | |
public TriggerStep(String spec) { | |
this.spec = spec; | |
} | |
public String getSpec() { |
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
2016/06/06 11:22:58 [INFO] Terraform version: 0.7.0 rc1 301da85f30239e87b30db254a25706a6d41c2522 | |
2016/06/06 11:22:58 [DEBUG] Detected home directory from env var: /Users/djasek | |
2016/06/06 11:22:58 [DEBUG] Detected home directory from env var: /Users/djasek | |
2016/06/06 11:22:58 [DEBUG] Attempting to open CLI config file: /Users/djasek/.terraformrc | |
2016/06/06 11:22:58 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
2016/06/06 11:22:58 [DEBUG] Detected home directory from env var: /Users/djasek | |
2016/06/06 11:22:58 [TRACE] Graph after step *terraform.ConfigTransformer: | |
module.envTesting - *terraform.GraphNodeConfigModule | |
provider.aws - *terraform.GraphNodeConfigProvider |
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 com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.ser.FilterProvider; | |
import lombok.extern.slf4j.Slf4j; | |
import org.glassfish.hk2.api.ServiceLocator; | |
import org.glassfish.hk2.api.TypeLiteral; | |
import org.glassfish.jersey.CommonProperties; | |
import org.glassfish.jersey.ServiceLocatorProvider; | |
import org.glassfish.jersey.internal.InternalProperties; | |
import org.glassfish.jersey.internal.util.PropertiesHelper; | |
import org.glassfish.jersey.jackson.internal.JacksonFilteringFeature; |
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
git-flow release start $NEWVER | |
mvn versions:set -DnewVersion=$NEWVER versions:update-child-modules -DgenerateBackupPoms=false -Prpm -Pintegration | |
git commit -m "Update to release version." | |
export GIT_MERGE_AUTOEDIT=no | |
git-flow release finish -m '$NEWVER' $NEWVER | |
mvn versions:set -DnewVersion=$NEWVER-SNAPSHOT versions:update-child-modules -DgenerateBackupPoms=false -Prpm -Pintegration | |
mvn release:update-versions --batch-mode -DautoVersionSubmodules=true -Prpm -Pintegration | |
git commit -a -m "Prepare for new version." |
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
class ProbNode: | |
"""Stores the probability of getting a specific number of colluding nodes within a group. | |
Also contains the remaining nodes and colluding nodes in the network that are not in the group.""" | |
def __init__(self, nodes, colluding, group, quorum, upstream_prob): | |
self.prob = upstream_prob * ((binomial(colluding, quorum) * binomial(nodes-colluding,group-quorum))/binomial(nodes, group)) | |
self.nodes = nodes - group | |
self.colluding = colluding - quorum | |
def rcoin_control(pnodes, group, quorum, required_groups): | |
if required_groups == 0: |
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 static IObservable<WState> WindowOpensAndCloses<T>(this IObservable<IObservable<T>> This, bool verify_exclusive = true) { | |
var state = WState.Close; | |
var ret = Observable.Merge(This.Select(_ => WState.Open), | |
This.SelectMany(x => x.Materialize()) | |
.Where(x => x.Kind == NotificationKind.OnCompleted || | |
x.Kind == NotificationKind.OnError) | |
.Select(_ => WState.Close)); | |
if(verify_exclusive) return ret.Do(x => | |
{ |
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
using System; | |
using log4net.Core; | |
using ReactiveUI; | |
namespace Logger { | |
public class log4netLogger : ILog { | |
private readonly log4net.ILog _log; | |
public log4netLogger(string prefix) |
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
//MultiDictionary is a Dictionary-like object that can store multiple values for the same key. | |
public class MultiDictionary<TKey, TValue> :ICollection<KeyValuePair<TKey, TValue>>, ICollection { | |
private Dictionary<TKey, HashSet<TValue>> _collection = new Dictionary<TKey,HashSet<TValue>>(); | |
public IEnumerable<TValue> this[TKey key] { | |
get { | |
if(!_collection.ContainsKey(key)) return new List<TValue>(); | |
return _collection[key]; | |
} | |
} |
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
<def tag="tabs"> | |
<set-scoped tab-names="&[]" tab-contents="&{}"> | |
<ul class="tabs" merge> | |
<do param="default" /> | |
</ul> | |
<do repeat="&scope.tab_names"> | |
<div id="#{this}"> | |
<%= scope.tab_contents[this] %> | |
</div> | |
</do> |
NewerOlder