Skip to content

Instantly share code, notes, and snippets.

View Blei's full-sized avatar

Philipp Brüschweiler Blei

View GitHub Profile
@Blei
Blei / PKGBUILD
Created May 22, 2016 12:14
vim-command-t
# Maintainer: Sebastien Leduc <sebastien@sleduc.fr>
# Contributor: Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>
pkgname="vim-command-t"
pkgver=4.0
pkgrel=1
pkgdesc="an extremely fast, intuitive mechanism for opening files and buffers with a minimal number of keystrokes"
arch=("i686" "x86_64")
url="https://wincent.com/products/command-t"
license=("BSD")
@Blei
Blei / gist:ce56811b8f156bc4f234
Created December 11, 2014 18:59
Not very descriptive error message
<std macros>:3:22: 3:41 error: invalid format string: unmatched `}` found
<std macros>:3 write!($dst, concat!($fmt, "\n") $($arg)*)
^~~~~~~~~~~~~~~~~~~
@Blei
Blei / gc_count_mmap.rs
Created August 7, 2014 20:10
Rust GC Count -- Memmap
//based off https://gist.github.com/samuell/5555803
extern crate native;
extern crate rustrt;
use native::io::file;
use rustrt::rtio;
use rustrt::rtio::RtioFileStream;
use std::os;
#[deriving(PartialEq,Eq,Show)]
//////////////////////////////////
// in rgtk
//////////////////////////////////
impl Window {
/* ... */
pub fn connect_destroy_signal(&self, handler: ~WidgetDestroyHandler) {
let data = unsafe { cast::transmute::<~~WidgetDestroyHandler, ffi::gpointer>(~handler) };
"destroy".with_c_str(|cstr| {
@Blei
Blei / gist:7787352
Created December 4, 2013 13:23
wtf, rust?
// Config.rs:34
fn save_PrettyJSON<'a, T: Encodable<json::PrettyEncoder<'a>>>(p: &Path, toEncode: ~[T]) {
match File::create(p) {
Some(f) => {
let f2 = @mut f as @mut io::Writer;
let a = &mut json::PrettyEncoder::init(f2);
toEncode.encode(a);
}, None => fail!("failed to save json")
};
@Blei
Blei / wut?
Created November 27, 2013 19:34
rusttracks % LANG=C rustc test.rs -L../dumb-gtk --link-args "$(pkg-config --libs gtk+-3.0)"
test.rs:9:4: 9:13 warning: unused import, #[warn(unused_imports)] on by default
test.rs:9 use std::task;
^~~~~~~~~
error: linking with `cc` failed: exit code: 1
note: cc arguments: -L/home/philipp/programming/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib -m64 -o test test.o -L/home/philipp/programming/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib -lstd-6425b930ca146ae9-0.9-pre -L/home/philipp/programming/rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib -lrustuv-a13edc95d75df17-0.9-pre -L../dumb-gtk -lgtk-2f2c3f42f26b7cc3-0.0 -L../dumb-gtk -L/home/philipp/programming/rust-misc/rusttracks/.rust -L/home/philipp/programming/rust-misc/rusttracks -Wl,--as-needed -lrt -ldl -lm -lmorestack -lrustrt -Wl,-rpath,$ORIGIN/../../rust/x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib -Wl,-rpath,$ORIGIN/../dumb-gtk
mod a {
extern {
fn my_fn(a: *u8);
}
}
mod b {
extern {
fn my_fn(a: *u16);
}
@Blei
Blei / gist:5276888
Created March 30, 2013 14:22
DPMS!
From 15903829aa8f8553829770ce052dc165797738e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Br=C3=BCschweiler?= <blei42@gmail.com>
Date: Fri, 29 Mar 2013 20:32:54 +0100
Subject: [PATCH] compositor: don't let weston terminate with dpms set to off
if possible
This will not catch the cases where weston crashes, but it's at least
better than the current state.
---
src/compositor.c | 28 +++++++++++++++++++---------
@Blei
Blei / part 1
Last active December 14, 2015 18:19
From 995bc862ee398257ffd97d48d6d62fcd9107db2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Br=C3=BCschweiler?= <blei42@gmail.com>
Date: Sun, 10 Mar 2013 14:12:49 +0100
Subject: [PATCH 1/2] compositor: remove unused field option_idle_time
---
src/compositor.c | 1 -
src/compositor.h | 3 +--
2 files changed, 1 insertion(+), 3 deletions(-)
@Blei
Blei / gist:5118802
Last active December 14, 2015 16:59
Fix sw rendering for wayland
diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c b/src/gallium/state_trackers/egl/wayland/native_shm.c
index a959237..2499677 100644
--- a/src/gallium/state_trackers/egl/wayland/native_shm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_shm.c
@@ -163,7 +163,7 @@ wayland_shm_display_init_screen(struct native_display *ndpy)
return FALSE;
if (shmdpy->base.formats == 0)
- wayland_roundtrip(shmdpy->base.dpy);
+ wayland_roundtrip(&shmdpy->base);