Name | Description |
---|---|
ruby |
The redis gem with the plain-Ruby driver |
hiredis |
The redis gem with the hiredis driver (compiled as a C extension) |
myredis |
Pure-Ruby, optimized for the specific operation |
This file contains 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 ubuntu:20.04 AS redisjson | |
RUN apt-get update | |
RUN apt-get upgrade -y git | |
RUN apt-get install -y curl gcc | |
RUN apt-get install -y libclang-dev | |
WORKDIR / | |
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o install-rust.sh && sh ./install-rust.sh -y | |
RUN git clone https://github.com/RedisJSON/RedisJSON.git --branch v2.4.4 |
This file contains 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 | |
# Install nginx ingress controller | |
# NOTE: This uses DigitalOcean. If you use another Kubernetes provider, | |
# substitute the appropriate command from here: https://kubernetes.github.io/ingress-nginx/deploy/#cloud-deployments | |
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/do/deploy.yaml | |
# FOR DIGITALOCEAN DEPLOYMENTS: | |
export LB_HOSTNAME=example.com # Make this the DNS name that will point to your LB | |
export LB_NAME=my-lb # Give this a useful name to identify it on the DigitalOcean control panel |
This file contains 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 | |
# Fill out these two | |
export LB_HOSTNAME=example.com | |
export LB_NAME=my-lb | |
echo '{"metadata":{"annotations":{"service.beta.kubernetes.io/do-loadbalancer-hostname":"$LB_HOSTNAME","service.beta.kubernetes.io/do-loadbalancer-name":"$LB_NAME"}}}' | | |
envsubst | | |
awk "{ print \"'\" \$1 \"'\" }" | | |
xargs kubectl patch svc -n ingress-nginx ingress-nginx-controller -p |
This file contains 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
# Experiment with macros to allow for project-local requires | |
# https://forum.crystal-lang.org/t/project-relative-require/4617 | |
{% begin %} | |
ROOT = "{{system("pwd").strip.id}}" | |
{% end %} | |
macro spec(file) | |
macro load_spec | |
\{% path = __DIR__.gsub(%r{\A{{ROOT.id}}}, "").gsub(%r{[^/]+}, "..").id %} | |
require "\{{path[1..]}}/spec/{{file.id}}" |
This file contains 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
require "http" | |
require "json" | |
require "uuid/json" | |
require "db" | |
require "interro" # github: jgaskins/interro | |
require "faker" # github: askn/faker | |
ES = ElasticSearch::Client.new | |
pg = DB.open("postgres:///") | |
Interro.config { |c| c.db = pg } |
This file contains 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
class ImmutableEachArray(T) | |
include Enumerable(T) | |
@iterating = Atomic(Int32).new(0) | |
@array = Array(T).new | |
def <<(value : T) : self | |
raise CannotMutateWhileIterating.new("you iteratin bruh") if @iterating.get > 0 | |
@array << value |
This file contains 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
require 'bundler/inline' | |
require 'socket' | |
class MyRedis | |
CRLF = "\r\n" | |
def initialize | |
@connection = TCPSocket.new('localhost', 6379) | |
@connection.sync = false | |
end |
This file contains 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
require "http" | |
require "./route" | |
class App | |
include HTTP::Handler | |
include Route | |
def call(context) | |
route context do |r, response| |
This file contains 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
require "benchmark" | |
value = nil | |
Benchmark.ips do |x| | |
x.report "1 ivar" { value = OneIVar.new } | |
x.report "2 ivars" { value = TwoIVars.new } | |
x.report "4 ivars" { value = FourIVars.new } | |
x.report "8 ivars" { value = EightIVars.new } | |
x.report "16 ivars" { value = SixteenIVars.new } | |
end |