Skip to content

Instantly share code, notes, and snippets.

View coelho's full-sized avatar

Robert Coelho coelho

View GitHub Profile
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.security.InvalidAlgorithmParameterException;
@coelho
coelho / qryn-schema.sql
Last active August 1, 2022 09:12
QRYN Distributed Schema
// NOTE: Make sure you set SAMPLES_DAYS: 3650 & LABELS_DAYS: 3650 to avoid the `ALTER TABLE ...`
// NOTE: You also need to set "distributed_product_mode" to "global" in your profile.
// https://clickhouse.com/docs/en/operations/settings/settings-profiles/
CREATE TABLE qryn.samples_read (
`fingerprint` UInt64,
`timestamp_ms` Int64,
`value` Float64,
`string` String
@coelho
coelho / gist:9907277
Last active August 29, 2015 13:57
VotifierV2 PHP Implementation
<?php
class VotifierV2 {
private $service;
private $privateKey;
public function __construct($service, $privateKey) {
$this->service = $service;
$this->privateKey = $privateKey;
@coelho
coelho / gist:9887580
Created March 31, 2014 08:14
Generate key pairs for Votifier
<?php
$keyPair = openssl_pkey_new(array('private_key_bits' => 2048));
// Private key
openssl_pkey_export($keyPair, $privateKey);
// Public key
$publicKey = openssl_pkey_get_details($keyPair);
$publicKey = $publicKey["key"];