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
| # A B C | |
| # B C E | |
| # C G | |
| # D A F | |
| # E F | |
| # F H | |
| require 'rgl/adjacency' | |
| require 'rgl/traversal' | |
| require 'rgl/dot' | |
| require 'test/unit' |
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
| -module(kata2). | |
| -export([chop/0, chop/2]). | |
| % http://stackoverflow.com/questions/1035655/list-is-conceived-as-integer-by-length-function | |
| chop() -> chop(6,[2,4,6,8,10]). | |
| chop(Result) -> io:format("Location index... ~w~n", [Result-1]). | |
| chop(Val, List) -> | |
| if List == [] -> | |
| -1; |
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 | |
| # | |
| # redis - this script starts and stops the redis-server daemon | |
| # | |
| # chkconfig: - 85 15 | |
| # description: Redis is a persistent key-value database | |
| # processname: redis-server | |
| # config: /etc/redis/redis.conf | |
| # config: /etc/sysconfig/redis | |
| # pidfile: /var/run/redis.pid |
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
| if Rails::VERSION::MAJOR == 2 | |
| require "active_support/core_ext/string/output_safety" | |
| class ERB | |
| module Util | |
| # see https://github.com/rails/rails/issues/7430 | |
| def html_escape(s) | |
| s = s.to_s | |
| if s.html_safe? | |
| s |
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 get_interface(tdb_id, server) | |
| Decom.log.debug "Finding eth0 interface" | |
| eth0_interface = server['interfaces'].find{|interface| interface['name'] == 'eth0' }; Decom.log.debug "server eth0 interface: #{eth0_interface.inspect}" | |
| eth0_interface = thingsdb["interfaces/#{eth0_interface['id']}"].get; Decom.log.debug "eth0 interface: #{eth0_interface.inspect}" | |
| eth0_interface | |
| end |
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.twitter.zipkin.gen.{Span => ThriftSpan} | |
| import com.twitter.finagle.stats.StatsReceiver | |
| import com.twitter.server.TwitterServer | |
| import com.twitter.util.{Await, Future} | |
| import com.twitter.zipkin.cassandra.CassieSpanStoreFactory | |
| import com.twitter.zipkin.collector.{SpanReceiver, ZipkinQueuedCollectorFactory} | |
| import com.twitter.zipkin.common._ | |
| import com.twitter.zipkin.receiver.kafka.KafkaSpanReceiverFactory | |
| import com.twitter.zipkin.storage.WriteSpanStore | |
| import com.twitter.zipkin.zookeeper.ZooKeeperClientFactory |
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
| /zipkin|master:bin/collector | |
| [info] Loading project definition from /Users/jway/code/zipkin/project | |
| [warn] Multiple resolvers having different access mechanism configured with same name 'local'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`). | |
| [info] Set current project to zipkin (in build file:/Users/jway/code/zipkin/) | |
| [info] Set current project to zipkin-collector-service (in build file:/Users/jway/code/zipkin/) | |
| [info] Writing build properties to: /Users/jway/code/zipkin/zipkin-collector-service/target/resource_managed/main/com/twitter/zipkin/build.properties | |
| [error] I 1204 16:31:37.815 THREAD1 org.apache.zookeeper.Environment.logEnv: Client environment:user.dir=/Users/jway/code/zipkin | |
| [error] I 1204 16:31:37.816 THREAD1 org.apache.zookeeper.ZooKeeper.<init>: Initiating client connection, connectString=localhost:2181 sessionTimeout=6000 watcher=org.I0Itec.zkclient.ZkClient@19b27f92 | |
| [error] I 1204 16:31:42.918 THREAD43 org.apache.zookeeper.Clien |
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
| //https://groups.google.com/forum/#!topic/finaglers/0g2ySTVtZsg | |
| import com.twitter.finagle.stats.{Counter, Gauge, Stat, StatsReceiver} | |
| /** | |
| * Created by mmlac on 8/13/14. | |
| */ | |
| class StatsDStatsReceiver extends StatsReceiver { | |
| override val repr: AnyRef = this | |
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
| From: /Users/jway/code/faraday-zipkin/lib/faraday-zipkin/trace_headers.rb @ line 53 Faraday::Zipkin::TraceHeaders#call: | |
| 48: trace_id = ::Trace.id | |
| 49: ::Trace.push(trace_id.next_id) | |
| 50: B3_HEADERS.each do |method, header| | |
| 51: Pry.config.input = STDIN | |
| 52: Pry.config.output = STDOUT | |
| => 53: binding.pry | |
| 54: env[:request_headers][header] = ::Trace.id.send(method).to_s | |
| 55: end |
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
| Fix Leader election Problems | |
| [Note] this method may work every time | |
| [Note] this was initially caused by deleting the kafka hosts and reprovisioning | |
| delete the topic using zkCli.sh | |
| rmr /brokers/topics/test2 | |
| sudo service kafka restart (on all the broker hosts using rundeck) | |
| change to a different topic in your producer | |
| you might see the number of LeaderNotAvailableException go down, maybe its doing some kind of replication here | |
| at this point the consumer should be able to get messages and if u produce more, it should have fewer exceptions or 0 |