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
| sudo vim /etc/systemd/journald.conf | |
| less /var/log/syslog | |
| sudo vim /etc/rsyslog.conf | |
| sudo systemctl status rsyslog | |
| - Syslog conf on sender side: | |
| # Provides TCP forwarding. But the current server runs on UDP | |
| *.* @@10.0.0.51:514 |
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 | |
| if [ -z $1 ]; then | |
| echo "Usage: first argument is the machine alias on which you want to deploy" | |
| exit 1 | |
| fi | |
| HOST_ALIAS=$1 | |
| PROJECT_NAME=${PWD##*/} # basename of current dir | |
| if ! [ -z $2 ]; then |
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
| package main | |
| import ( | |
| "bufio" | |
| "encoding/json" | |
| "fmt" | |
| "net/url" | |
| "net/http" | |
| "os" | |
| "time" |
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://godoc.org/github.com/Shopify/sarama | |
| # https://github.com/spotify/docker-kafka | |
| wget http://apache.websitebeheerjd.nl/kafka/0.8.2.1/kafka_2.11-0.8.2.1.tgz | |
| tar xvzf kafka_2.11-0.8.2.1.tgz | |
| cd kafka_2.11-0.8.2.1 | |
| # With docker installed | |
| docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=`boot2docker ip` --env ADVERTISED_PORT=9092 spotify/kafka |
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
| "use strict"; | |
| var ECKey = require('eckey') | |
| var fs = require('fs') | |
| var seed = process.argv[2] | |
| var bytes = new Uint8Array(32); | |
| for (var i = 0; i < seed.length; i += 2) { |
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
| package main | |
| import ( | |
| "crypto/ecdsa" | |
| "crypto/elliptic" | |
| "crypto/rand" | |
| "crypto/x509" | |
| "flag" | |
| "fmt" | |
| "io/ioutil" |
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
| #!/usr/bin/ruby | |
| # Run with | |
| # $ ruby -r minitest/autorun $PROGRAM_NAME | |
| # | |
| # Returns the correct version among multiple given | |
| # hashes. In other words, which hash is the one | |
| # that most ressemble the other hashes ? | |
| # | |
| # First a Hash has to be able to say | |
| # how similar it is to another one |
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
| # Defining a fast immutable struct while | |
| # keeping Struct value object behaviour | |
| class ImmutableStruct < Struct | |
| undef []=, send | |
| def self.inherited(subclass) | |
| subclass.instance_methods.grep(/\w=/) do |setter| | |
| undef_method setter | |
| 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
| # A good intermediary for internal-only access of instance variables | |
| # Here the example is with the access on the 'sauce' instance variable | |
| class Salad | |
| def initialize(sauce) | |
| @sauce = sauce | |
| end | |
| attr_reader :sauce |
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
| Customer = Struct.new(:name, :address) | |
| c = Customer.new('john') # Do not validate construction | |
| c.name # => 'john' | |
| c.address # => nil | |
| c['name'] # => 'john' | |
| # Extra unneeded API to access your property | |
| c['name'] = 'robert' |