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
import asyncio | |
import grpc | |
from recommender_pb2_grpc import RecommenderStub | |
from recommender_pb2 import RecommendRequest | |
async def run() -> None: | |
async with grpc.aio.insecure_channel('localhost:50051') as channel: | |
client = RecommenderStub(channel) |
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
import asyncio | |
async def foo(sem, i): | |
async with sem: | |
print("acquired", i) | |
await asyncio.sleep(1) | |
print("released", i) | |
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
{ | |
tx { | |
byHeight(height: 6708762) { | |
tx { | |
body { | |
messages | |
} | |
} | |
logs { | |
events { |
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::sync::Arc; | |
struct Foo(); | |
fn main() { | |
let x = Foo(); | |
// x.clone(); // `Foo` is not `Clone` | |
let x = Arc::new(x); // Wrap in `Arc` | |
x.clone(); // Works because `Arc` is `Clone` |
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
enum MyOption<T> { | |
MySome(T), | |
MyNone, | |
} | |
use MyOption::{MyNone, MySome}; | |
fn main() { | |
let mut x = MySome(1i32); | |
x = MyNone; |
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::collections::HashMap; | |
use std::sync::mpsc::{sync_channel, Receiver, SyncSender}; | |
use std::sync::{Arc, Mutex}; | |
use num::Unsigned; | |
struct Price<T> { | |
value: Option<T>, | |
waiters: Option<Vec<SyncSender<T>>>, | |
} |
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
terracli config node http://public-node.terra.dev:26657 | |
terracli config chain-id columbus-4 | |
terracli config trust-node false |
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::{ | |
collections::HashMap, | |
sync::{ | |
mpsc::{self, RecvError, Sender}, | |
Arc, Mutex, | |
}, | |
}; | |
struct Price { | |
value: Option<u128>, |
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 thiserror::Error; | |
#[derive(Debug, Error)] | |
enum A { | |
#[error("")] | |
ErrorA {}, | |
} | |
#[derive(Debug, Error)] | |
enum B { |
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
# On an Apple Silicon computer, install Rosetta 2 and the amd64 version of Go, then | |
arch -x86_64 make install |