Skip to content

Instantly share code, notes, and snippets.

View anacrolix's full-sized avatar
🏹
Pew pew

Matt Joiner anacrolix

🏹
Pew pew
View GitHub Profile
actor Main
new create(env: Env) =>
let chain = DivisibleFilter(2, Printer(env), env)
let g = Generator(1_000_000, chain)
actor Generator
var _i: I = 2
let _max: I
let _next: Next
new create(max: I, next: Next) =>
actor Main
new create(env: Env) =>
let chain = DivisibleFilter(2, Printer(env), env)
let g = Generator(100000000, chain)
actor Generator
new create(max: I, next: Next tag) =>
var i: I = 2
while i <= max do
next.apply(i)
trait ExtendValues<T> {
fn extend_values<I>(&mut self, iter: I)
where
I: Iterator<Item = T>;
}
impl<K, V, E, T> ExtendValues<(K, E)> for HashMap<K, V>
where
K: Eq + std::hash::Hash,
use crate::common::*;
use serde::Deserialize;
pub fn decode(path: &str) -> Result<Vec<LatLonBox>> {
let f = std::fs::File::open(path)?;
let mut zip_archive = zip::ZipArchive::new(f)?;
let doc_file = zip_archive.by_name("doc.kml")?;
let doc: KmlDoc = serde_xml_rs::from_reader(doc_file)?;
Ok(doc
.document
use crate::common::*;
use serde::Deserialize;
pub fn decode(path: &str) -> Result<Vec<LatLonBox>> {
let f = std::fs::File::open(path)?;
let mut zip_archive = zip::ZipArchive::new(f)?;
let doc_file = zip_archive.by_name("doc.kml")?;
let doc: KmlDoc = serde_xml_rs::from_reader(doc_file)?;
Ok(doc
.document
use core::future::Future;
use std::collections::HashMap;
use std::default::Default;
use std::fmt::Debug;
use std::hash::Hash;
use tokio::sync::watch;
use tokio::sync::Mutex;
#[derive(Default)]
pub struct Group<K: Hash + Eq, V: Clone + Debug> {
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
thread 'tokio-runtime-worker' panicked at 'gai background task failed: JoinError::Cancelled', /Users/anacrolix/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.1/src/client/connect/dns.rs:144:30
stack backtrace:
0: 0x10979d6b5 - std::sys_common::at_exit_imp::push::h0636e6b5f7616352
1: 0x1097c16a0 - core::fmt::ArgumentV1::show_usize::hca33af0aed7db5c5
2: 0x10979900b - std::io::Write::write_fmt::he6837371b9a45188
3: 0x10979f403 - std::panicking::default_hook::{{closure}}::h708e66cfeb0483ba
4: 0x10979f10a - std::panicking::default_hook::h39ea8ddf674c04ec
5: 0x10979facb - <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get::hf147e9d6b92d24d8
6: 0x10979f659 - std::panicking::continue_panic_fmt::h2dfa3a5b90265361
@anacrolix
anacrolix / programming predictions
Created December 16, 2019 03:39
written in 2011
Microsoft will release a mainstream functional programming language.
Google will release their own language for development on Android. If they lose the Java court case, it will take off.
Google won’t lose the Java court case.
In 2014, Python 3000 will finally displace Python 2.
Hardware Transactional Memory will be released on chips in 2013. By 2015, it will be incorporated into most compilers and provide almost magical performance and correctness improvements on SMP.
http://www.h-online.com/newsticker/news/item/Processor-Whispers-About-Haskell-and-Haswell-1389507.html
@anacrolix
anacrolix / handle_use.rs
Created November 20, 2019 05:26
use of handle!
let result = handle!(result, err, {
error!("error receiving messages: {}", err);
continue;
});
trace!("got message result");
for msg in result.messages.unwrap_or_default() {
let body = msg.body.unwrap();
let _delete = sqs
.delete_message(rusoto_sqs::DeleteMessageRequest {
queue_url: queue_url.to_owned(),
macro_rules! handle {
($value:expr, $err:ident,$onerr:expr) => {
match $value {
Ok(ok) => ok,
Err($err) => $onerr,
}
};
}