Skip to content

Instantly share code, notes, and snippets.

View charliek's full-sized avatar

Charlie Knudsen charliek

View GitHub Profile
@peterpalmieri
peterpalmieri / cassandra.yaml
Last active February 10, 2016 01:09
Datadog Cassandra config
instances:
- host: localhost
port: 7199
cassandra_aliasing: true
init_config:
# List of metrics to be collected by the integration
# Read http://docs.datadoghq.com/integrations/java/ to learn how to customize it
conf:
- include:
domain: org.apache.cassandra.metrics
@danhyun
danhyun / EmbeddedSpec.groovy
Created July 27, 2015 23:02
Registering Guice Modules via GroovyEmbeddedApp
package ratpack.groovy
import com.google.inject.AbstractModule
import ratpack.groovy.test.embed.GroovyEmbeddedApp
import ratpack.guice.Guice
import spock.lang.Specification
class EmbeddedSpec extends Specification {
def "GroovyEmbeddedApp with Guice Module"() {
given:
@mxlje
mxlje / ssl.md
Last active January 10, 2022 02:03
SSL Certificate Commands

These commands are needed every time you want to generate a new certificate signing request to give to an authority in order for them to generate and sign a certificate for you.

https://letsencrypt.org/ solves a lot of the pain involved with SSL certs, but sometimes you still need to go the "old school" route. I constantly forget how this stuff works, so I collected the most important commands (and what they do) here for easy copy & paste.

Generate new private key

@rbranson
rbranson / gist:038afa9ad7af3693efd0
Last active September 29, 2016 17:44
Disaggregated Proxy & Storage Nodes

The point of this is to use cheap machines with small/slow storage to coordinate client requests while dedicating the machines with the big and fast storage to doing what they do best. I found that request coordination was contributing to about half the CPU usage on our Cassandra nodes, on average. Solid state storage is quite expensive, nearly doubling the cost of typical hardware. It also means that if people have control over hardware placement within the network, they can place proxy nodes closer to the client without impacting their storage footprint or fault tolerance characteristics.

This is accomplished in Cassandra by passing the -Dcassandra.join_ring=false option when the process is started. These nodes will connect to the seeds, cache the gossip data, load the schema, and begin listening for client requests. Messages like "/x.x.x.x is now UP!" will appear on the other nodes.

There are also some more practical benefits to this. Handling client requests caused us to push the NewSize of the heap up

@rhart
rhart / Ratpack.groovy
Created December 20, 2014 23:09
Ratpack HTTP Proxy
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import ratpack.handling.Context
import ratpack.handling.Handler
import ratpack.http.client.HttpClient
import ratpack.http.client.StreamedResponse
import ratpack.http.MutableHeaders
import ratpack.http.client.RequestSpec
import static ratpack.groovy.Groovy.ratpack
@jbeda
jbeda / manifest-template.yaml
Created October 23, 2014 22:28
Script to create VM to host private docker registry on GCE backed by GCS
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@mikemaccana
mikemaccana / gist:10847077
Created April 16, 2014 10:13
Tptacek's Review of "Practical Cryptography With Go"

Wow. I've now read the whole book and much of the supporting code. I'm not a fan, and recommend against relying on it. Here's a laundry list of concerns:

  • The teaching method the book uses is badly flawed. The book's strategy is to start simple and build to complexity, which makes sense if you're teaching algebra but not if you're teaching heart surgery. The result is that each chapter culminates with the implementation of a system that is grievously insecure. Little warning is given of this, apart from allusions to future chapters improving the system. For instance, Chapter 2 closes with a chat system that uses AES-CBC without an authenticator.

  • The book is full of idiosyncratic recommendations. For instance, AES-CBC requires a padding scheme. There is a standard padding scheme. The book purports to present it, but instead of PKCS7, it presents 80h+00h..00h.

  • At one point about 1/3rd of the way through the book, it suggests using a SHA256 hash of the plaintext as an authenticator for a message. Thi

@mattetti
mattetti / main.go
Created January 6, 2014 01:59
Static web server in Go that can be cross compiled for Windows, Linux, Mac etc.. Content available in the public folder will be served automatically.
package main
import (
"log"
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("public")))
log.Println("About to start the server on port 8014")
@mgodave
mgodave / gist:7646319
Last active April 3, 2019 08:41
Create a single value Observable from a Guava ListenableFuture.
public static <T> Observable<T> create(ListenableFuture<T> future, Executor executor) {
AsyncSubject<T> subject = AsyncSubject.create();
future.addListener(() -> {
try {
T value = future.get();
subject.onNext(value);
subject.onCompleted();
} catch (Exception e) {
subject.onError(e);
}