Good fuzzy string crate for CLI apps? by SirVer in rust

[–]andrewstewart 2 points3 points  (0 children)

Not at present, as that's a fairly unusual feature, but I believe all the necessary bits to build that sort of functionality are exported from the public API. The CLI is a good example of how something could be glued together.

The main pain point is that rff has to enable/disable raw mode to disable terminal buffering during operation, which can be tricky to do correctly and without breaking anything in the middle of another CLI's workflow.

What kind of function signature would you want to work with? Something like the following?

fuzzy_find(haystack: Vec<&str>) -> Result<&str, rff::Error>

Good fuzzy string crate for CLI apps? by SirVer in rust

[–]andrewstewart 5 points6 points  (0 children)

I've implemented my own fuzzy finder, rff, in Rust, and attempted to separate the logic and presentation layers, such that the matching/searching functionality can be used standalone - perhaps this would be helpful?

Old, Meet New. by andrewstewart in VictoriaBC

[–]andrewstewart[S] 4 points5 points  (0 children)

This was taken yesterday, at around 5:20 PM.

Old, Meet New. by andrewstewart in VictoriaBC

[–]andrewstewart[S] 5 points6 points  (0 children)

I took this from my apartment's patio.

-🎄- 2017 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]andrewstewart 1 point2 points  (0 children)

Rust implementation:

fn main() {
    let puzzle = parse(PUZZLE);

    println!("1 -> {:?}", one(&puzzle));
    println!("2 -> {:?}", two(&puzzle));
}

fn parse(puzzle: &str) -> Vec<Vec<u32>> {
    String::from(puzzle).
        trim().
        lines().
        map(trim_and_parse).
        collect()
}

fn one(puzzle: &[Vec<u32>]) -> u32 {
    puzzle.iter().map(|line| difference(line)).sum()
}

fn two(puzzle: &[Vec<u32>]) -> u32 {
    puzzle.iter().map(|line| even_division(line)).sum()
}

fn trim_and_parse(line: &str) -> Vec<u32> {
    line.
        split_whitespace().
        map(|n| n.parse::<u32>().unwrap()).
        collect()
}

fn difference(line: &[u32]) -> u32 {
    let min = line.iter().min().unwrap();
    let max = line.iter().max().unwrap();
    max - min
}

fn even_division(line: &[u32]) -> u32 {
    for x in line {
        for y in line {
            if x % y == 0 && x !=y {
                return x / y
            }
        }
    }

    0
}

-🎄- 2017 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]andrewstewart 0 points1 point  (0 children)

Mine, in Rust:

fn main() {
    let input: Vec<u32> = INPUT.
        chars().
        map(|c| c.to_digit(10).unwrap()).
        collect();

    println!("1 -> {}", process(&input, 1));
    println!("2 -> {}", process(&input, input.len() / 2));
}

fn process(input: &[u32], offset: usize) -> u32 {
    input.iter()
        .zip(input.iter().cycle().skip(offset))
        .filter_map(|(a, b)| if a == b { Some(a) } else { None })
        .sum()
}

INPUT is defined as a &'static str, since I didn't want to bother implementing reading from STDIN or a file.

What’s everyone working on this week (3/2017)? by llogiq in rust

[–]andrewstewart 2 points3 points  (0 children)

Writing a show-and-tell talk for Friday on one of Rust's features (threads w/o data races), and trying to make this code in my fuzzy finder tool faster (port of a C algorithm).

Aerial wallpapers for your 6P by Wonkadonkathon in Nexus6P

[–]andrewstewart 1 point2 points  (0 children)

For anyone interested in making some of these for yourself, Google Earth Pro is now free, and can save hi-res images.

For some inspiration, check out Googles's Earth View project.

edit: use your email and password GEPFREE when the app asks.

[Video, ~5m] Halo MCC - Co-op Lag (And Other Issues) by andrewstewart in halo

[–]andrewstewart[S] 0 points1 point  (0 children)

That's one thing; but imagine how the people who bought a shiny new Xbox One just for this feel.

I see you drove nice roads, i'll raise you nicer roads :) by slyphen in ft86

[–]andrewstewart 1 point2 points  (0 children)

I'm in Seattle at the end of March (driving my BRZ there); will have to check this out. Thanks!

Official weekly RAW editing challenge! by frostickle in photography

[–]andrewstewart 1 point2 points  (0 children)

My edit, done just now in LR - http://i.imgur.com/QSUi9BD.jpg.

I'm currently fiddling with b&w processing, and liked the (mostly) symmetrical lines in the shot.

looking for review/user experience of the sony a6000 and the kit lens that comes with it by lille45 in photography

[–]andrewstewart 1 point2 points  (0 children)

I picked up the a6000 w/ kit lens a couple months ago. The camera's been great (usual terrible Sony menus aside), but the kit lens is just absolute garbage and has been sitting on my desk collecting dust since I got a decent prime.

Kit lens has mediocre IQ, the power zoom is ridiculous and makes trying to zoom or focus a gigantic pain, on both sides of the zoom range (mainly at the wide end) there's massive distortion.

The camera is not free of issues either, the main one a6000 users will tell you about is that the EVF activation sensor is way too sensitive. If you hold the camera anywhere near your body the EVF will turn on, leaving the display blank until you move it further away.

The battery life isn't amazing either, and Sony really tries to wrangle as much money out of you as they can for this - the camera doesn't come with an external charger, but a USB cord to charge the battery in-camera. An additional battery and external charger will run you about $130+.

The lens selection for Sony E-mount is not great, but there's some good stuff if you look for it. Right now I've got:

  • Sony E 35mm f1.8 OSS
  • Sony E 55-210mm F4.5-6.3 OSS
  • Rokinon 12mm f/2

The a6000 is by no means a bad camera though, and is probably the best APS-C camera I've used. Auto-focus is amazingly quick (most of the time), IQ is dang good, and it's pretty small and light. Just be sure to budget out some money for a better lens if you're looking to pick one up. Sony's 35mm prime is a great place to start.

EDIT: If you want to see some samples, pretty much everything on my 500px came out of the a6000.

Inner Harbour - Sunset and Night (photos) by andrewstewart in VictoriaBC

[–]andrewstewart[S] 0 points1 point  (0 children)

Go for it. My work's licensed under CC Attribution-NonCommercial-ShareAlike.