Skip to content

Instantly share code, notes, and snippets.

View pythonesque's full-sized avatar

Joshua Yanovski pythonesque

  • Lanetix
  • San Francisco, CA
View GitHub Profile
use list::Node;
mod list {
use std::mem;
#[derive(Show)]
pub struct Node<T> {
pub data: T,
prev: Option<Box<Node<T>>>,
next: Option<Box<Node<T>>>
[INFO] Entry point EntryPoint { name: "main", execution_model: Vertex, work_group_size: WorkGroupSize { x: 0, y: 0, z: 0 } }
[DEBUG] SPIRV-Cross generated shader:
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct u_locals
{
packed_float3 model_offs;
#![feature(if_let)]
use nomove::{freeze, freeze_box, FreezeSlice, NoMoveGuard};
use std::cell::Cell;
mod nomove {
pub struct NoMoveGuard<T> {
pub data: T,
no_copy: ::std::kinds::marker::NoCopy,
}
struct Foo(uint);
fn main()
{
enum Bar { Baz(Foo) };
let x = Baz(Foo(4));
fn foo(_bar : uint) -> Foo { Foo(3) }
match x {
Baz(foo(x)) => println!("{:?}", x)
@pythonesque
pythonesque / phonebook.rs
Last active December 26, 2015 14:09
Failing with a runtime assertion on Rust 0.8 on Ubuntu 12.0.4.
#0 0x00007ffff62c9910 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x00007ffff741db0a in rust_begin_unwind (token=839147) at /home/ubuntu/rust/rust-0.8/src/rt/rust_builtin.cpp:509
#2 0x00007ffff77a04a6 in rt::task::Unwinder::begin_unwind::h7c12263797ed078hEa6::v0.8 ()
from /home/ubuntu/rust/src/../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8.so
#3 0x00007ffff779f7d3 in sys::begin_unwind_::h89e154cd0915671ak::v0.8 () from /home/ubuntu/rust/src/../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8.so
#4 0x00007ffff779f302 in sys::__extensions__::fail_with::anon::anon::expr_fn::aV () from /home/ubuntu/rust/src/../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8.so
#5 0x00007ffff779f228 in c_str::ToCStr::with_c_str::hc6798931b183a7aS::v0.8 () from /home/ubuntu/rust/src/../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.8.so
#6 0x00007f
#!/usr/bin/env ruby
require 'uri'
require 'set'
urls = Set.new()
STDIN.each_line do|line|
begin
url = URI.parse(line.downcase).host
#![feature(core)]
macro_rules! inherit {
{
$(#[$flag_struct:meta])* struct $child:ident : $parent:ty {
$($(#[$flag_field:meta])* $field:ident: $ty:ty),*
}
} => {
extern crate core;
@pythonesque
pythonesque / intrusive.rs
Created September 14, 2015 12:00
Safe (?) interface for intrusive structures
#![cfg_attr(test, feature(rustc_private))]
use std::cell::UnsafeCell;
use std::marker::PhantomData;
use std::ops;
struct InvariantLifetime<'id>(
PhantomData<*mut &'id ()>);
impl<'id> InvariantLifetime<'id> {
#[inline]
@pythonesque
pythonesque / cuckoo
Created June 18, 2015 18:31
Build flags for cuckoo
# Build instructions
# Build initial libraries
cargo build --release
# Build executable as I have been doing.
#HASH = insert hash here \
rustc src/lib.rs --crate-name libcukoo --crate-type bin \
-C target-cpu=native -C prefer-dynamic -C opt-level=3 \
-C metadata=$HASH -C extra-filename=-$HASH --out-dir ./target/release \
@pythonesque
pythonesque / slurp.rs
Last active August 29, 2015 14:22 — forked from paulp/slurp.rs
use std::ffi::OsStr;
use std::process::Command;
use std::borrow::Cow;
use std::convert::Into;
pub fn exec_slurp<'a>(cmd: &'a str, args: &[&OsStr]) -> Cow<'a, str> {
println!("exec_slurp({}, {:?})", cmd, args);
Command::new(cmd)
.args(args)