Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jeremyvdw on github.
  • I am jeremyvdw (https://keybase.io/jeremyvdw) on keybase.
  • I have a public key ASBe6KIUEymKPKaJFhbUX0YrRuNVGbRav5i_Xd24TGGafwo

To claim this, I am signing this object:

@jeremyvdw
jeremyvdw / gist:2c613a06a83007e8f393
Created January 6, 2016 15:16
CircleCI: Cassandra fails to boot
curl -sSL https://s3.amazonaws.com/circle-downloads/wait-for-cassandra.sh | sh
Attempt 1
nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection refused'.
Attempt 2
nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection refused'.
Attempt 3
nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection refused'.
Attempt 4
nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection refused'.
Attempt 5
@jeremyvdw
jeremyvdw / schema-registry
Created June 22, 2015 08:35
Confluent schema-registry basic startup
#!/bin/bash
#
#
# init script for the Confluent schema-registry
#
# chkconfig: 2345 90 10
# description: Confluent schema-registry
### BEGIN INIT INFO
# Provides: schema-registry
2015-03-12T16:11:27.042875+00:00 app[outlet.1]: source=coliseum_integration ns=Outlet fn=event_received num=548 type=HailUpdated id=977207ee-c61c-844d-8dd6-c4f9408b0051 received=152
2015-03-12T16:11:27.177147+00:00 app[outlet.1]: #<NoMethodError: undefined method `bytesize' for nil:NilClass>
2015-03-12T16:11:27.197090+00:00 app[outlet.1]:
2015-03-12T16:11:27.197092+00:00 app[outlet.1]:
2015-03-12T16:11:27.197213+00:00 app[outlet.1]: /app/vendor/bundle/ruby/2.2.0/gems/beefcake-1.1.0.pre1/lib/beefcake/buffer/base.rb:86:in `length'
2015-03-12T16:11:27.197271+00:00 app[outlet.1]: /app/vendor/bundle/ruby/2.2.0/gems/beefcake-1.1.0.pre1/lib/beefcake.rb:174:in `decode'
2015-03-12T16:11:27.197307+00:00 app[outlet.1]: /app/vendor/bundle/ruby/2.2.0/gems/beefcake-1.1.0.pre1/lib/beefcake/buffer/base.rb:97:in `read'
2015-03-12T16:11:27.197355+00:00 app[outlet.1]: /app/vendor/bundle/ruby/2.2.0/gems/beefcake-1.1.0.pre1/lib/beefcake.rb:203:in `decode'
2015-03-12T16:11:27.197391+00:00 app[outlet.1]: /app/vendor/bundle/ruby/2.2
@jeremyvdw
jeremyvdw / gist:7583eec5c5a3ed3b1505
Created January 16, 2015 13:11
Axe 4: Promises/Futures

Promises/Futures

background

La ludification a introduit une pression globalement plus forte à de multiples endroits de la plateforme. Durant les opérations de scoring, étape essentielle du jeu, de nombreuses informations doivent être écrites pour mettre à jours les scores des joueurs, leurs statistiques, les statistiques internes à la plateforme, ainsi que d’autres données concernant l’état du joueur dans le jeu en cours.
Il s’agit d’une matrice importante d’informations: pour chaque joueur, chaque opération de scoring provoque au minimum 97 opération d’écritures en base de données, jusqu’à 120 dans certains cas, et au moins 3 opérations de lecture.
En moyenne, chaque match compte 180 opportunités de prédiction (GuessOpportunity), chacune de celle ci comporte au minimum 100 prédictions (Guess).

La figure suivante représente une partie des opérations de lecture/écriture lors du scoring d'une prédiction d'un joueur.

# Holds the current point at any given moment
# set: the set we're in
# game: the game we're in
# point: the point we're in (aggregated)
#
# Ex:
# +----------+---+---+---+----+
# | Nadal* | 6 | 4 | 5 | 30 |
# +----------+---+---+---+----+ ==> Nadal is serving for: Point.new(3,8,4)
# | Djokovic | 4 | 6 | 2 | 15 |
@jeremyvdw
jeremyvdw / docker_cleanup
Created July 1, 2014 11:27
Docker: cleans exited containers and unused images
# delete all non-running container
docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm
# delete unused images
docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi
An exception occurred running /usta_recorder/vendor/bundle/rbx/2.1/bin/rackup:
stream closed (EOFError)
Backtrace:
IO(TCPSocket)#read_nonblock at kernel/common/io.rb:1891
Net::BufferedIO#rbuf_fill at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-protocol-2.0.1/lib/rubysl/net/protocol/protocol.rb:153
Net::BufferedIO#readuntil at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-protocol-2.0.1/lib/rubysl/net/protocol/protocol.rb:134
Net::BufferedIO#readline at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-protocol-2.0.1/lib/rubysl/net/protocol/protocol.rb:144
Net::HTTPResponse.read_status_line at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-http-2.0.4/lib/net/http/response.rb:39
Net::HTTPResponse.read_new at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-http-2.0.4/lib/net/http/response.rb:28
{ } in Net::HTTP#transport_request at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-http-2.0.4/lib/rubysl/net/http/http.rb:1407
# List of environments and their heroku git remotes (id: 'remote_name')
HEROKU_ENVIRONMENTS = {
staging: 'staging-remote-name',
production: 'production-remote-name'
}
namespace :deploy do
# Create rake tasks to deploy on Heroku environments
# $ rake -T deploy
# rake deploy:production # Deploy to production
@jeremyvdw
jeremyvdw / gist:7351993
Created November 7, 2013 09:52
Using chruby with buildbox.io
if [[ -e /usr/local/share/chruby ]]; then
# Load chruby
source '/usr/local/share/chruby/chruby.sh'
# Automatically switch rubies
source '/usr/local/share/chruby/auto.sh'
# Set a default ruby if a .ruby-version file exists in the home dir
if [[ -f ~/.ruby-version ]]; then
chruby $(cat ~/.ruby-version)