Skip to content

Instantly share code, notes, and snippets.

View saethlin's full-sized avatar
🦀

Ben Kimock saethlin

🦀
View GitHub Profile
Total time: 16.4064 s
File: neufeld_plots.py
Function: main at line 1
Line # Hits Time Per Hit % Time Line Contents
==============================================================
1 @profile
2 def main():
3 1 168872.0 168872.0 1.0 import numpy as np
4 1 108349.0 108349.0 0.7 import matplotlib
@saethlin
saethlin / uhhhhhhh.rs
Created December 7, 2017 02:04
What trait bounds? These trait bounds
error[E0599]: no method named `for_each` found for type `std::boxed::Box<websocket::<unnamed>::Future<Error=websocket::WebSocketError, Item=(websocket::client::async::Framed<websocket::client::async::TlsStream<tokio_core::net::TcpStream>, websocket::async::MessageCodec<websocket::OwnedMessage>>, websocket::header::Headers)> + 'static>` in the current scope
--> src/main.rs:31:10
|
31 | .for_each(|_| println!("test"));
| ^^^^^^^^
|
= note: the method `for_each` exists but the following trait bounds were not satisfied:
`std::boxed::Box<websocket::<unnamed>::Future<Error=websocket::WebSocketError, Item=(websocket::client::async::Framed<websocket::client::async::TlsStream<tokio_core::net::TcpStream>, websocket::async::MessageCodec<websocket::OwnedMessage>>, websocket::header::Headers)>> : websocket::<unnamed>::Stream`
`std::boxed::Box<websocket::<unnamed>::Future<Error=websocket::WebSocketError, Item=(websocket::client::async::Framed<websocket::client::async::Tl
@saethlin
saethlin / termbox_bug.rs
Last active December 6, 2017 00:09
termbox bug?
//! ```cargo
//! [dependencies]
//! termbox_simple = "0.2.0"
//! ```
extern crate termbox_simple;
use termbox_simple::Termbox;
use std::sync::{Arc, Mutex};
use std::thread;
import numpy as np
from scipy.misc import imsave
max_y = 0
max_x = 0
with open('Stego_3.txt') as f:
contents = f.readlines()
coordinates = []
@saethlin
saethlin / all_cargo.txt
Last active October 18, 2017 18:43
stats on Rust build configs
╰ ➤ find | grep Cargo.toml | xargs wc -l | sort -n
4 ./src/tools/tidy/Cargo.toml
6 ./src/tools/remote-test-client/Cargo.toml
6 ./src/tools/remote-test-server/Cargo.toml
8 ./src/tools/cargotest/Cargo.toml
8 ./src/tools/linkchecker/Cargo.toml
9 ./src/libarena/Cargo.toml
9 ./src/libfmt_macros/Cargo.toml
9 ./src/libgraphviz/Cargo.toml
9 ./src/librustc_platform_intrinsics/Cargo.toml
@saethlin
saethlin / window.rs
Created October 16, 2017 20:26
This kills the rustfmt
use std::fmt::Debug;
use widget::Widget;
use xcb;
pub struct Window {
connection: xcb::Connection,
id: u32,
widgets: Vec<Box<Widget>>,
}
@saethlin
saethlin / unused_imports.rs
Created October 12, 2017 20:46
rustc unused imports bug
#[macro_use]
extern crate derive_more;
use std::ops::{Add, Sub, Div, Mul};
#[derive(Debug, Clone, Copy, Add, Mul)]
pub struct Vec3 {
pub x: f64,
pub y: f64,
pub z: f64,
}
@saethlin
saethlin / parens.rs
Last active September 16, 2017 03:47
Valid Parentheses
pub struct Solution {}
impl Solution {
pub fn is_valid(s: &str) -> bool {
let mut num_open_seen = 0;
for (i, c) in s.chars().enumerate() {
let maybe_last_open = s.split_at(i)
.0
.chars()
.rev()
@saethlin
saethlin / constant_fold.rs
Last active September 15, 2017 17:45
Matching on box attempt
enum ExprNode {
Number(f64),
Variable(CString),
BinaryOperation(char, Box<ExprNode>, Box<ExprNode>),
FunctionCall(CString, Vec<Box<ExprNode>>),
IfElse(Box<ExprNode>, Box<ExprNode>, Box<ExprNode>),
ForLoop(Box<ExprNode>, Box<ExprNode>, Option<Box<ExprNode>>, Box<ExprNode>),
}
if let (ExprNode::Number(l), ExprNode::Number(r)) = (*lhs, *rhs) {
@saethlin
saethlin / Cargo.toml
Created September 6, 2017 23:31
Demonstration of thread-safety enforced by Rust's type system
[package]
name = "typedemo"
version = "0.1.0"
authors = ["saethlin <[email protected]>"]
[dependencies.cpython]
version = "0.1"
features = ["extension-module"]
[lib]