Now that we live in the Big Data, Web 3.14159 era, lots of people want to build databases that are too big to fit on a single machine. But there's a problem in the form of the CAP theorem, which states that if your network ever partitions (a machine goes down, or part of the network loses its connection to the rest) then you can keep consistency (all machines return the same answer to
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 sieve(s: Stream[Int]): Stream[Int] = | |
s.head #:: sieve(s.tail filter(_ % s.head != 0)) | |
val primes = sieve(Stream.from(2)) | |
primes.take(100).toList |
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 flash.Lib; | |
import flash.display.Sprite; | |
import flash.display.Bitmap; | |
import flash.display.BitmapData; | |
import openfl.Assets; | |
import openfl.display.Tilesheet; | |
import flash.display.Graphics; | |
import flash.events.Event; | |
class Particle |
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
# Original Gist: https://gist.github.com/trinitronx/5979265 | |
# RP Gist: https://gist.github.com/returnpathadmin/dbffee1d3d675f271435 | |
# Function to set git author & committer email addresses based on your cwd | |
# Uses the very first .gitemail file found while traversing up directories | |
# Use case: As a developer, | |
# Given that I have a .gitemail file in my work directory containing my work email | |
# When I am in the work directory | |
# Then I should be able to commit with my work email address | |
# Given that I have a .gitemail file in my public directory containing my public email | |
# When I am in the public directory |
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
object FlickrBase58Coder { | |
val alpha = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" | |
val base = alpha.length | |
def apply(encodedInput: String) = decode(encodedInput) | |
def apply(decodedInput: Long) = encode(decodedInput) | |
def encode(input: String): String = encode(input.toLong) | |
def encode(input: Long) = { | |
def enc(in: Long, acc: String): String = if (in < 1) acc else enc(in / base, alpha((in % base).toInt) + acc) |
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/env bash | |
# Step 1: Fill in EMAIL, TOKEN, DOMAIN and SUBDOMAIN. Your API token is here: https://dash.cloudflare.com/profile/api-tokens | |
# Make sure the token is the Global token, or has these permissions: #zone:read, #dns_record:read, #dns_records:edit | |
# If you want to set the root domain instead of a subdomain, set SUBDOMAIN to "@" | |
# Step 2: Create an A record on Cloudflare with the subdomain you chose | |
# Step 3: Run "./ddns.sh -l" to get the zone_id and rec_id of the record you created. | |
# Fill in ZONE_ID and REC_ID below | |
# This step is optional, but will save you 2 requests every time you run this script | |
# Step 4: Run "./ddns.sh". It should tell you that record was updated or that it didn't need updating. |
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
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
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
Router.map(function () { | |
this.route('index', { | |
controller: 'BasicController', | |
layoutTemplate: 'indexLayout', | |
path: '/', | |
waitOn: function () { | |
return Meteor.subscribe('Channels'); | |
} | |
}); |
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 mesosphere.mesos.util.FrameworkInfo | |
import org.apache.mesos.MesosSchedulerDriver | |
/** | |
* @author Tobi Knaup | |
*/ | |
object Main extends App { |
Slightly disorganized but reasonably complete notes on the algorithms, strategies and optimizations of the Akka Cluster implementation. Could use a lot more links and context etc., but was just written for my own understanding. Might be expanded later.
Links to papers and talks that have inspired the implementation can be found on the 10 last pages of this presentation.
This is the Gossip state representation: