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
use async_trait::async_trait; | |
use diesel::{ | |
connection::SimpleConnection, | |
dsl::Limit, | |
query_dsl::{ | |
methods::{ExecuteDsl, LimitDsl, LoadQuery}, | |
RunQueryDsl, | |
}, | |
r2d2::{ConnectionManager, Pool, R2D2Connection}, | |
result::QueryResult, |
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
#include <iostream> | |
#include <vector> | |
#include "flow/flow.h" | |
#include "flow/DeterministicRandom.h" | |
#include "flow/actorcompiler.h" | |
// Simple counting actor that: | |
// 1. Logs a tag on start and finish. | |
// 2. Waits for some time. | |
// 3. Returns the new number. |
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 "pstore" | |
require "thread" | |
require "securerandom" | |
module ActivePublisher | |
module Async | |
module DiskBackedQueue | |
class Page | |
attr_reader :file_path |
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
type NoOpWriteCloser struct { | |
writer io.Writer | |
} | |
func (c *NoOpWriteCloser) Write(p []byte) (int, error) { | |
return c.writer.Write(p) | |
} | |
func (c *NoOpWriteCloser) Close() error { | |
return nil | |
} |
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 "openssl" | |
def create_ssl_context(options) | |
# Create our certs and key converters to go from bouncycastle to java. | |
cert_converter = org.bouncycastle.cert.jcajce.JcaX509CertificateConverter.new | |
key_converter = org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter.new | |
# Load the certs and keys. | |
tls_ca_cert = cert_converter.getCertificate(read_pem_object_from_file(options[:tls_ca_cert])) | |
tls_client_cert = cert_converter.getCertificate(read_pem_object_from_file(options[:tls_client_cert])) |
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 "socket" | |
class Client | |
def initialize(addr, port, user, db) | |
@user = user | |
@db = db | |
@socket = TCPSocket.new(addr, port) | |
end | |
def login_packet |
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
module Protobuf | |
module Nats | |
class ThreadPool | |
def initialize(size, opts = {}) | |
@queue = ::Queue.new | |
@active_work = 0 | |
# Callbacks | |
@error_cb = lambda {|_error|} |
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
# frozen_string_literal: true | |
module Arel | |
module Visitors | |
class Visitor | |
def initialize | |
@dispatch = get_dispatch_cache | |
@random = [0.1, 0.5, 1, 2, 4] | |
end | |
def accept object |
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
// CREDITS HERE | |
// FROM: http://apple.stackexchange.com/questions/81234/how-to-remove-caps-lock-delay-on-apple-macbook-pro-aluminum-keyboard | |
// FROM: https://bugs.launchpad.net/mactel-support/+bug/585244 | |
#include <linux/hidraw.h> | |
#include <sys/ioctl.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <string.h> |
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
# super-tab | |
Mod4 Tab :NextWindow {groups} (workspace=[current]) | |
Mod4 Shift Tab :PrevWindow {groups} (workspace=[current]) | |
### TILING WINDOWS ### | |
#1920 / 2 = 960 | |
#1080 / 2 = 540 | |
Control KP_0 :Minimize | |
Control KP_1 :MacroCmd {ResizeTo 958 540} {MoveTo 00 00 LowerLeft} | |
Control KP_2 :MacroCmd {ResizeTo 1920 540} {MoveTo 00 00 LowerLeft} |
NewerOlder