Skip to content

Instantly share code, notes, and snippets.

View rbishop's full-sized avatar

Richard Bishop rbishop

View GitHub Profile
@rbishop
rbishop / after.ex
Created August 18, 2015 15:06
Replacing imperative if/else with lazy, infinite Stream. I had to remove some of the specifics for security purposes but hopefully this shows the general idea.
def loop(model, models) do
task_sup = Process.whereis(:worker_supervisor)
Stream.resource(
fn -> {model, 0} end,
&func_that_gets_data/1,
fn(_) -> :ok end
)
|> Stream.chunk(20)
|> Stream.map(fn(ids) -> Task.Supervisor.async(task_sup, Worker, :sanitize, [model, ids]) end)
@rbishop
rbishop / egpu.md
Last active July 25, 2020 16:41
2013 MacBook Pro eGPU build

Context

I bought a new Dell U2720Q monitor but the onboard graphics on my 13 inch 2013 MacBook Pro (Catalina) was not powerful enough to drive it at 3840x2160@60Hz. I had been using the Apple Thunderbolt Display prior to this and I really liked how through a single Thunderbolt cable it connected the display, ethernet, and USB devices. I didn't want to buy a new laptop as this one is still powerful enough for my needs of programming and not gaming.

As such, my parameters for an enclosure were that:

  • Small form factor. A lot of enclosures such as the Sonnet Breakaway Box and Razer Core X are very large.
  • This isn't for gaming so I didn't need a beefy video card or an enclosure with a really high wattage power supply.
  • Thunderbolt 3. While my current laptop is Thunderbolt 2 I recognize I won't have it for more than 2-3 more years and will eventually have a Thunderbolt 3 computer.
  • Ethernet and USB ports on the enclosure were a plus but not a hard requirement. The idea of having as many of my peripherals