defmodule CryptoPals do
def base16to64(x) do
x
|> Base.decode16!(case: :lower)
|> Base.encode64()
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
def okx_signing(config, %{url: url, body: body, method: method}) do | |
secret = config["okx_secret_key"] | |
access_key = "your access key" | |
timestamp = DateTime.utc_now() |> DateTime.truncate(:millisecond) |> DateTime.to_iso8601() | |
%{path: path, query: query} = URI.new!(url) | |
data = timestamp <> method <> path <> "?" <> query <> body | |
sign = :crypto.mac(:hmac, :sha256, secret, data) |> Base.encode64() |
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
curl -Lo roots.pem https://pki.google.com/roots.pem | |
export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH="$PWD/roots.pem" | |
apt-get install 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
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils libboost-all-dev | |
./autogen.sh | |
mkdir build | |
cd build | |
../configure --disable-wallet | |
make |
Some token transaction lost in DragonGlass token query api.
JAM transaction: https://app.dragonglass.me/transactions/002855761648193481472999010
"validStartDate": "2022-03-25T07:31:21.472999010Z"
"consensusTimeStamp": "2022-03-25T07:31:33.792727Z"
curl -v -H "X-API-KEY: [APIKEY]" "https://api.dragonglass.me/hedera/api/hts/tokens/0.0.127877/transfers?accountId=0.0.618675&transferAfter=2022-03-25T06:33:20Z&transferBefore=2022-03-25T09:20:00Z";
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
defmodule SqlDb do | |
@moduledoc """ | |
# Benchmark of Save and Find | |
Name ips average deviation median 99th % | |
btree 50.43 0.0198 s ±6.77% 0.0197 s 0.0268 s | |
list 0.85 1.18 s ±0.28% 1.17 s 1.18 s | |
Comparison: | |
btree 50.43 |
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
fn main() { | |
// Linjie Zhang 2020 | |
// | |
// 3-state busy beaver | |
// https://en.wikipedia.org/wiki/Turing_machine | |
let rules = vec!["A01RB", "A11LC", "B01LA", "B11RB", "C01LB", "C11RH"] | |
.iter() | |
.map(|x| x.chars().collect::<Vec<char>>()) | |
.collect::<Vec<_>>(); |
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
fn main() { | |
// Linjie Zhang 2020 | |
// | |
// T simple turing machine | |
// | |
// https://plato.stanford.edu/entries/turing-machine/#DefiTuriMach | |
#[derive(Debug)] | |
struct Machine { |
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
<mxfile host="localhost" modified="2020-05-18T07:49:48.710Z" agent="5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.45.0 Chrome/78.0.3904.130 Electron/7.2.4 Safari/537.36" etag="lm6PZiSR0-wQZ33-puXF" version="13.0.9"> | |
<diagram id="6hGFLwfOUW9BJ-s0fimq" name="Page-1"> | |
<mxGraphModel dx="483" dy="592" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> | |
<root> | |
<mxCell id="0"/> | |
<mxCell id="1" parent="0"/> | |
<mxCell id="14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=0;curved=1;" edge="1" parent="1" source="12" target="13"> | |
<mxGeometry relative="1" as="geometry"/> | |
</mxCell> | |
<mxCell id="15" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0; |
NewerOlder