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 std::fs::File; | |
use std::io::Write; | |
use pprof::protos::Message; | |
#[inline(never)] | |
fn is_prime_number1(v: usize, prime_numbers: &[usize]) -> bool { |
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
package x | |
import ( | |
"os" | |
"github.com/slack-go/slack" | |
"go.uber.org/zap" | |
) | |
var api = slack.New(os.Getenv("SLACK_TOKEN")) |
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 anyhow::Error; | |
use wasmtime::{ Engine, Extern, Func, Instance, Memory, MemoryType, Module, Store, Trap, TypedFunc, AsContextMut}; | |
/// OpenPolicy is used to load the compiled wasm module in Rust runtime. | |
pub struct OpenPolicy{ | |
// global ctx of wasm policy. TODO: can be reused. | |
engine: Engine, | |
// loaded wasm module TODO: can be reused. | |
module: Module, | |
// wasm module with all the neccessary import. |
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
delay marshar 02m18s | |
withour delay 02m31s | |
delat marshal with pool 02m35s |
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
previous 2m45s | |
keys/10 shard 2m50s | |
keys/20 shard 03m07s | |
keys/15 shard 03m05s | |
keys/8 shard 03m04s |
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
package main | |
import ( | |
"crypto/rand" | |
"encoding/hex" | |
"io/ioutil" | |
"os" | |
"sync" | |
"testing" | |
) |
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
echo "[Boto]" >> /etc/boto.cfg | |
echo "https_validate_certificates= False" >> /etc/boto.cfg | |
wget https://raw.githubusercontent.com/elazarl/goproxy/master/ca.pem | |
mv ca.pem ca.crt | |
cp ca.crt /usr/local/share/ca-certificates | |
update-ca-certificates |
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
extern crate chan_signal; | |
use chan_signal::Signal; | |
use std::sync::mpsc; | |
use std::sync::mpsc::{Receiver, Sender}; | |
use std::thread; | |
enum ReceiveMessage { | |
Work(Box<Fn() + Send>), | |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <fcntl.h> | |
#include <err.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/socket.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
sudo su - | |
apt-get install -y gcc make socat git | |
# Install etcd | |
curl -L https://github.com/coreos/etcd/releases/download/v3.0.17/etcd-v3.0.17-linux-amd64.tar.gz -o etcd-v3.0.17-linux-amd64.tar.gz && tar xzvf etcd-v3.0.17-linux-amd64.tar.gz && /bin/cp -f etcd-v3.0.17-linux-amd64/{etcd,etcdctl} /usr/bin && rm -rf etcd-v3.0.17-linux-amd64* | |
#Install go | |
sudo curl -O https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz | |
sudo tar -xvf go1.9.1.linux-amd64.tar.gz | |
sudo mv go /usr/local |