Skip to content

Instantly share code, notes, and snippets.

💭
hmu

Zack Corr z0w0

💭
hmu
Block or report user

Report or block z0w0

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
@z0w0
z0w0 / cvimrc
Created Oct 24, 2017
My cvim configuration
View cvimrc
set nohud
set nosmoothscroll
set noautofocus
set typelinkhints
let barposition = "bottom"
let scrollstep = 100
let vimcommand = "nvim-qt"
let qmark T = ["http://todoist.com"]
@z0w0
z0w0 / rustpkg.md
Last active Dec 13, 2015
What's Rustpkg?
View rustpkg.md

What's Rustpkg?

Rustpkg is a revamp of Cargo that brings awesome new features such as a build system described in build scripts. It's a purely functional package manager that has no central sources of any kind, but rather installs via URLs. It's similar to how Go's go get tool works, except Rustpkg requires a central metadata file (pkg.rs) in the repository, archive or folder in order to figure out how to build the package. This is a side effect of Rustpkg allowing multiple crates to be defined in a single package (i.e. a package is defined as a set of crates rather than a package being exactly the same as one crate). There's a plan to make it so the pkg.rs is not needed for single-crate packages,

@z0w0
z0w0 / pkg.rs
Created Feb 11, 2013
Example of rustpkg for @bjz
View pkg.rs
#[pkg(id = "com.bjz.gl",
vers = "0.1.0")];
#[pkg_crate(file = "src/gl.rc")];
use run;
#[pkg_do(build)] // ran before declarative crates (i.e. this will run and then the crate defined above will)
fn build() {
run::run_program(~"lua", ~[~"LoadGen.lua". ~"-style=pointer_rust",
~"-spec=gl", ~"-version=3.3", ~"-profile=core",
@z0w0
z0w0 / error
Created Feb 9, 2013
Re-exporting glob issue in Rust
View error
error: failed to resolve imports
src/sdl.rc:19:8: 19:17 error: unresolved import
src/sdl.rc:19 pub use event::*;
^~~~~~~~~
src/event.rs:1:4: 1:16 error: unresolved import
src/event.rs:1 use libc::c_int;
^~~~~~~~~~~~
src/cd.rs:1:4: 1:16 error: unresolved import
src/cd.rs:1 use libc::c_int;
^~~~~~~~~~~~
@z0w0
z0w0 / rustpkg_w_lib.rs
Last active Dec 12, 2015
Really hacky example of how to compile a CC file using rustpkg. Rustpkg needs heaps of changes before I would even suggest doing anything like this.
View rustpkg_w_lib.rs
// this is a horrible way to do it, but it would work
#[pkg(id = "com.frozencow.some_binding",
vers = "0.1.1")];
#[pkg_crate(file = "src/some_binding.rc")]; // the binding has FFI stuff that links to -lsome_lib
// this would be wrapped by default..
fn cc(path: &Path) {
run::run_program(~"cc", ~[~"-shared", ~"-o", rustpkg::build_dir().push(~"lib").push(~"some_lib.so").to_str(), path.to_str()]);
}
@z0w0
z0w0 / haul.md
Last active Feb 9, 2017
Haul, a purely functional package manager for Rust
View haul.md

Haul

Features

  • Purely functional
    • Different versions of packages can coexist
    • Each package must have a UUID, so packages with conflicting names can coexist
  • Build logic
    • Each package's metadata and build logic is written in a central Rust source file, package.rs
    • Dependencies are declared in the package file and will be fetched and installed before
@z0w0
z0w0 / gist:3608372
Created Sep 3, 2012
Quickcheck in Rust
View gist:3608372
// each argument is randomized (error if the argument is not a primitive type or string)
#[quickcheck(tries = 1000)]
fn even(number: int) {
return number % 2 == 0;
}
@z0w0
z0w0 / gist:3562579
Created Sep 1, 2012
Tests using Rust's JIT
View gist:3562579
cfg: shell host triple i686-unknown-linux-gnu
cfg: enabling more debugging (CFG_ENABLE_DEBUG)
cfg: host for i686-unknown-linux-gnu is i386
cfg: unix-y environment
cfg: using gcc
cfg: no llnextgen found, omitting grammar-verification
cfg: including dist rules
cfg: including test rules
run rpass-full: i686-unknown-linux-gnu/stage2/bin/compiletest
View gist:3058314
enum key {
key_a,
key_b
}
enum event {
quit,
key(key)
}
@z0w0
z0w0 / net.rs
Created Jan 12, 2012
Extended IP address parsing for net.rs
View net.rs
/*
Module: net
*/
import core::{vec, uint, str};
/* Section: Types */
/*
Tag: ip_addr
You can’t perform that action at this time.