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
/// Add to Cargo.toml: | |
/// serde = "1.0" | |
/// serde_derive = "1.0" | |
/// serde_yaml = "0.8" | |
/// serde_json = "1.0" | |
use serde_derive::Deserialize; | |
use serde_json::{json, self}; | |
#[derive(Deserialize, Debug)] |
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::boxed::Box; | |
trait Drawable { | |
fn draw(&self); | |
} | |
struct Button { | |
pub size: i32, | |
} |
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
PID: 115094 (swaybar) | |
UID: 1000 (pimeys) | |
GID: 1000 (pimeys) | |
Signal: 6 (ABRT) | |
Timestamp: Wed 2019-01-23 19:10:25 CET (15min ago) | |
Command Line: swaybar -b bar-0 | |
Executable: /usr/bin/swaybar | |
Control Group: /user.slice/user-1000.slice/session-12.scope | |
Unit: session-12.scope | |
Slice: user-1000.slice |
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; | |
fn main() { | |
let mut map = HashMap::new(); | |
map.insert("foo", "bar"); | |
match map.get("foo") { | |
Some(_) => { | |
map.insert("foo", "baz"); // BOOM | |
}, |
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
// WARNING: This output format is intended for human consumers only | |
// and is subject to change without notice. Knock yourself out. | |
fn main() -> (){ | |
let mut _0: (); // return place | |
let mut _1: (); | |
let mut _2: std::fmt::Arguments; | |
let mut _3: &[&str]; | |
let mut _4: &[&str; 1]; | |
let mut _5: &[&str; 1]; | |
let mut _6: &[std::fmt::ArgumentV1]; |
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
#![feature(await_macro, async_await, futures_api)] | |
#[macro_use] | |
extern crate tokio; | |
extern crate hyper; | |
use tokio::prelude::*; | |
use hyper::Client; | |
use std::time::Duration; |
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
Compiling a2 v0.3.5 (/home/pimeys/code/a2) | |
error[E0277]: `(dyn tokio::prelude::Stream<Item=hyper::body::chunk::Chunk, Error=std::boxed::Box<(dyn std::error::Error + std::marker::Send + std::marker::Sync + 'static)>> + std::marker::Send + 'static)` cannot be shared between threads safely | |
--> examples/certificate_client.rs:14:5 | |
| | |
14 | tokio::run_async(async move { |
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
#!/usr/bin/env bash | |
set -eu | |
[[ -z "$(pgrep swaylock)" ]] || exit | |
[[ -z "$(pgrep convert)" ]] || exit | |
[[ -z "$(pgrep grim)" ]] || exit | |
TMPBG=/tmp/bg.png | |
grim $TMPBG |
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
#!/bin/bash | |
for f in *.zip; do | |
mkdir "$(basename -s .zip "$f")"; | |
unzip "$f" -d "$(basename -s .zip "$f")"; | |
done |
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
let work = client | |
.request(request) | |
.and_then(move |response| { | |
let (parts, body) = response.into_parts(); | |
body | |
.concat2() | |
.map(move |chunk| { | |
println!("{:?}", parts) | |
}) |