Skip to content

Instantly share code, notes, and snippets.

View pimeys's full-sized avatar

Julius de Bruijn pimeys

View GitHub Profile
/// 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)]
use std::boxed::Box;
trait Drawable {
fn draw(&self);
}
struct Button {
pub size: i32,
}
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
@pimeys
pimeys / nll.rs
Last active November 6, 2018 11:52
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
},
// 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];
#![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;
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 {
#!/usr/bin/env bash
set -eu
[[ -z "$(pgrep swaylock)" ]] || exit
[[ -z "$(pgrep convert)" ]] || exit
[[ -z "$(pgrep grim)" ]] || exit
TMPBG=/tmp/bg.png
grim $TMPBG
#!/bin/bash
for f in *.zip; do
mkdir "$(basename -s .zip "$f")";
unzip "$f" -d "$(basename -s .zip "$f")";
done
let work = client
.request(request)
.and_then(move |response| {
let (parts, body) = response.into_parts();
body
.concat2()
.map(move |chunk| {
println!("{:?}", parts)
})