Skip to content

Instantly share code, notes, and snippets.

Robbie Straw drbawb

Block or report user

Report or block drbawb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2f6a1c8e4e8d7e3e6a3dd2cdeffb41e7
alleluia=# select * from tags; │···
id | name | description | created_at | updated_at │···
----+-------------------+-------------+----------------------------+---------------------------- │···
1 | trailers | | 2015-03-21 00:50:51.892679 | 2015-03-21 00:50:51.892679 │···
2 | birds | | 2015-03-21 00:51:39.282225 | 2015-03-21 00:51:39.282225 │···
3 | mostly just birds |
@drbawb
drbawb / config
Last active Dec 8, 2018
sway output switching crash
View config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
@drbawb
drbawb / route.rs
Last active Aug 29, 2015
fn-ptr not `Clone` workaround
View route.rs
#[derive(Clone)]
pub struct Expression {
names: Vec<String>,
regex: Regex,
}
pub type Handler = fn(req: &Request, env: &mut Env) -> Result<String,String>;
pub struct Route {
matcher: Expression,
View gist:96d2d59dc03e46e27bc4
/home/drbawb/projects/piper/kyrie/src/world/services.rs:128:33: 128:41 error: use of moved value: `pub_sock`
/home/drbawb/projects/piper/kyrie/src/world/services.rs:128 let peer = ServicePeer::new(pub_sock, uid.clone());
^~~~~~~~
/home/drbawb/projects/piper/kyrie/src/world/services.rs:128:33: 128:41 note: `pub_sock` moved here because it has type `zmq::Socket`, which is non-copyable
/home/drbawb/projects/piper/kyrie/src/world/services.rs:128 let peer = ServicePeer::new(pub_sock, uid.clone());
^~~~~~~~
View gist:f57b3b4f4d4938686f2e
failures:
---- audio::test::test_audio_cvt stdout ----
thread 'audio::test::test_audio_cvt' panicked at 'assertion failed: `(left == right) && (right == left)`
---
LEFT:
`[0u8, 0u8, 0u8, 0u8, 1u8, 1u8, 1u8, 1u8, 2u8, 2u8, 0u8, 0u8, 3u8, 3u8, 1u8, 1u8, 4u8, 4u8, 0u8, 0u8, 5u8, 5u8, 1u8, 1u8, 6u8, 6u8, 0u8, 0u8, 7u8, 7u8, 1u8, 1u8, 8u8, 8u8, 0u8, 0u8, 9u8, 9u8, 1u8, 1u8, 10u8, 10u8, 0u8, 0u8, 11u8, 11u8, 1u8, 1u8, 12u8, 12u8, 0u8, 0u8, 13u8, 13u8, 1u8, 1u8, 14u8, 14u8, 0u8, 0u8, 15u8, 15u8, 1u8, 1u8, 16u8, 16u8, 0u8, 0u8, 17u8, 17u8, 1u8, 1u8, 18u8, 18u8, 0u8, 0u8, 19u8, 19u8, 1u8, 1u8, 20u8, 20u8, 0u8, 0u8, 21u8, 21u8, 1u8, 1u8, 22u8, 22u8, 0u8, 0u8, 23u8, 23u8, 1u8, 1u8, 24u8, 24u8, 0u8, 0u8, 25u8, 25u8, 1u8, 1u8, 26u8, 26u8, 0u8, 0u8, 27u8, 27u8, 1u8, 1u8, 28u8, 28u8, 0u8, 0u8, 29u8, 29u8, 1u8, 1u8, 30u8, 30u8, 0u8, 0u8, 31u8, 31u8, 1u8, 1u8, 32u8, 32u8, 0u8, 0u8, 33u8, 33u8, 1u8, 1u8, 34u8, 34u8, 0u8, 0u8, 35u8, 35u8, 1u8, 1u8, 36u8, 36u8, 0u8, 0u8, 37u8, 37u8, 1u8, 1u8, 38u8, 38u8, 0u8, 0u8, 39u8, 39u8
View Cargo.toml
[package]
name = "sdl-timer-ex"
version = "0.0.1"
[dependencies]
sdl2 = "*"
@drbawb
drbawb / locks.rs
Last active Aug 29, 2015
Data Race Example
View locks.rs
use std::io::timer::sleep;
use std::sync::{Arc,RWLock};
fn main() {
println!("running channels: ");
channels();
println!("running locks: ");
locks();
}
View units.rs
use std::f64;
static TILE_SIZE: i32 = 32;
pub struct Game(f64);
pub struct Pixel(i32);
pub struct Tile(uint);
pub struct Frame(uint);
pub trait AsGame {fn to_game(&self) -> Game;}
View main.rs
pub mod units;
/// A main() outside the module does not work, #to_pixel() not in scope?
fn main() {
let mut gs: units::Game = units::Game(640.0) * units::Game(480.0);
println!("gs->pix, outside mod: {:?}", gs.to_pixel());
}
View main.rs
use std::f64;
static TILE_SIZE: i32 = 32;
pub struct Game(f64);
pub struct Pixel(i32);
pub struct Tile(uint);
pub struct Frame(uint);
trait AsGame {fn to_game(&self) -> Game;}
You can’t perform that action at this time.