Skip to content

Instantly share code, notes, and snippets.

View U007D's full-sized avatar

Brad Gibson U007D

View GitHub Profile
//Transform iterable collection of Strings to iterable collection of &str and pass to libMain()
fn main() {
xargo_lld_wrapper::libMain(std::env::args().map(|el| el.as_str()).collect::<Vec<_>>());
}
--
/Users/bRad/.cargo/bin/cargo test --color=always -- --nocapture
Compiling xargo-lld-wrapper v0.1.0 (file:///Users/bRad/Development/bg/experiments/rust/rpi3/xargo-lld-wrapper)
error: `el` does not live long enough
--> src/main.rs:4:68
@U007D
U007D / DeclarativeExcerpt.cs
Created March 28, 2017 01:38
Imperative vs. Declarative Excerpts
return parser.ServiceNode.Nodes.OfType<TreeNode>()
.SelectMany(n => n.Nodes.OfType<TreeNode>())
.Single(n => n.Text == Protocol.Values[(int)protocol])
.Nodes.OfType<TreeNode>();
#![allow(unused_variables)]
trait ArgsExtMethods<'a, T> where Self: Iterator<Item = &'a T>,
T: Sized + 'a {
fn get_item_following_target(&mut self, target: T) -> Option<Self::Item> where Self: Sized,
T: PartialEq;
}
impl<'a, I, T> ArgsExtMethods<'a, T> for I where I: Iterator<Item = &'a T>,
T: Sized + PartialEq + 'a {
#[inline]
trait MyFilter: Iterator {
fn my_filter_arg(self, arg: Self::Item) -> MyFilterArgState<Self> where Self: Sized, {
MyFilterArgState { iter: self, arg: arg }
}
fn my_filter<P>(self, predicate: P) -> MyFilterState<Self, P> where Self: Sized,
P: Fn(&Self::Item) -> bool,
Self::Item: PartialEq, {
MyFilterState { iter: self, predicate: predicate }
}
}
Socrates:hello-world3 bRad$ lld
lld is a generic driver.
Invoke ld.lld (Unix), ld (macOS) or lld-link (Windows) instead.
Socrates:hello-world3 bRad$ ld -v
@(#)PROGRAM:ld PROJECT:ld64-278.4
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
LTO support using: LLVM version 8.1.0, (clang-802.0.41)
TAPI support using: Apple TAPI version 1.33.11
@U007D
U007D / .config
Last active May 10, 2017 20:47
crosstool-ng .config
#
# Automatically generated file; DO NOT EDIT.
# Crosstool-NG Configuration
#
CT_CONFIGURE_has_wget=y
CT_CONFIGURE_has_curl=y
CT_CONFIGURE_has_stat_flavor_BSD=y
CT_CONFIGURE_has_make_3_81_or_newer=y
CT_CONFIGURE_has_libtool_2_4_or_newer=y
CT_CONFIGURE_has_libtoolize_2_4_or_newer=y
@U007D
U007D / Homebrew Installation List.txt
Created May 9, 2017 01:03
Homebrew Installation List
autoconf gcc@4.9 isl libtool pkg-config
automake gdbm isl011 libunistring pyenv
binutils gettext isl@0.11 libvorbis python
cloog glib isl@0.12 lzip qemu
cloog018 gmp jpeg mpfr readline
cmake gmp4 lame mpfr2 sdl2
coreutils gmp@4 libffi mpfr@2 sdl2_mixer
doxygen gnu-getopt libmikmod nettle smpeg2
eigen gnu-indent libmodplug nmap sqlite
ffmpeg gnu-sed libmpc node wget
@U007D
U007D / build.log
Last active May 10, 2017 20:50
build.log
This file has been truncated, but you can view the full file.
[INFO ] Performing some trivial sanity checks
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
@U007D
U007D / multi_branch_early_return.rs
Last active May 15, 2017 18:38
Multi-branch early-return code examples
#![allow(unused_variables, dead_code)]
use std::fmt;
use std::error::Error;
fn main()
{
match do_work()
{
Ok(v) => assert!(v == 4),
@U007D
U007D / HexByteString.rs
Created May 31, 2017 22:18
Consuming String Iterator Example
extern crate owned_chars
use std::str::Chars;
use owned_chars::{OwnedChars, OwnedCharsExt};
...
#[derive(Debug)]
pub struct Iter<'a> {
iter: Chars<'a>,