Skip to content

Instantly share code, notes, and snippets.

@rsuniev
rsuniev / coreos-docker-update.sh
Created May 4, 2018 12:01 — forked from dm0-/coreos-docker-update.sh
Update Docker on CoreOS using torcx
#!/bin/bash -e
# Select which Docker version to use on CoreOS with torcx.
# Specify the available Docker version to enable.
version=17.09
# Create modifiable torcx paths if they don't exist already.
mkdir -p /etc/torcx/profiles /var/lib/torcx/store
# Download the torcx manifest file for the currently running OS version.
def authorize_key_for_root(config, *key_paths)
[*key_paths, nil].each do |key_path|
if key_path.nil?
fail "Public key not found at following paths: #{key_paths.join(', ')}"
end
full_key_path = File.expand_path(key_path)
if File.exists?(full_key_path)
config.vm.provision 'file',
@rsuniev
rsuniev / gist:0e1c50af4a892b68f903
Created January 6, 2016 15:26 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import akka.pattern.after
import akka.actor.Scheduler
/**
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown,
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure.
package derivation
import shapeless._
import shapeless.ops.coproduct.Length
import shapeless.ops.nat.ToInt
import scala.util.Random
sealed trait Animal
case class Cat(name: String, fish: Int) extends Animal
ActiveMQ Task-1] FailoverTransport INFO Successfully connected to tcp://MacBook-Pro.local:57022
[.local/172.28.1.21:57022@58129] FailoverTransport WARN Transport (tcp://MacBook-Pro.local/172.28.1.23:57022@58129) failed, reason: , attempting to automatically reconnect
java.io.EOFException
at java.io.DataInputStream.readInt(DataInputStream.java:392)
at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:258)
at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:221)
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:213)
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)
at java.lang.Thread.run(Thread.java:745)
[ main] ZooKeeper INFO Session: 0x148d131f76d002b closed
<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camel:camelContext xmlns="http://camel.apache.org/schema/blueprint" id="paginationRouteContext">
</camel:camelContext>
@rsuniev
rsuniev / SCC.scala
Created October 16, 2011 08:25 — forked from mads-hartmann/SCC.scala
Strongly Connected Components algorithm implemented in Scala
/*
This is implemented following the instructions in "The Design and Analysis of
Computer Algorithms, AHO Hopcroft Ullman, 1974".
The implementation uses a DFS to find the strongly connected components (SCCs)
of a graph. During the DFS the vertices are placed on a stack in the order
they are visited. Whenever a root is found, all vertices of the corresponding
SSC are on the top of the stack and are popped.
@rsuniev
rsuniev / SCC-scalaz.scala
Created October 16, 2011 08:24 — forked from mads-hartmann/SCC-scalaz.scala
Strongly Connected Components algorithm implemented in Scala using ScalaZ
/*
This is implemented following the instructions in "The Design and Analysis of
Computer Algorithms, AHO Hopcroft Ullman, 1974".
The implementation uses a DFS to find the strongly connected components (SCCs)
of a graph. During the DFS the vertices are placed on a stack in the order
they are visited. Whenever a root is found, all vertices of the corresponding
SSC are on the top of the stack and are popped.
@rsuniev
rsuniev / lensed.scala
Created September 25, 2011 10:55 — forked from gseitz/lensed.scala
Lensed
// see https://github.com/gseitz/Lensed
object Lensed {
import scalaz._
import Scalaz._
case class Address(street: String, number: Int)
case class Person(name: String, address: Address)