frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Flipbook – one-click file sharing for visual media scrubbing

https://browser-session-it94u.pages.dev/
1•keepamovin•7m ago•1 comments

Using a Bitcoin Microstructure Model to Predict Epileptic Seizures

https://zenodo.org/records/19669062
1•juhopaajanen•9m ago•0 comments

The Vercel Breach Needed Malware. The Next One Needs a Bad Readme

https://grith.ai/blog/next-vercel-breach-ai-coding-agent
1•edf13•12m ago•1 comments

Claude Cowork now has Live Artifacts

https://support.claude.com/en/articles/9487310-what-are-artifacts-and-how-do-i-use-them
1•manishfp•15m ago•1 comments

Following America's Artemis-2 Moon Mission Through China

https://www.china-in-space.com/p/following-americas-artemis-2-moon
1•JPLeRouzic•15m ago•0 comments

GitHub Copilot Pro+ not allowing Claude Opus 4.6

https://github.com/microsoft/vscode/issues/311590
2•vikrantrathore•17m ago•1 comments

The Toaster Project(2011) [pdf]

https://www.thomasthwaites.com/folio5/wp-content/uploads/2019/07/Toaster_Project-Thomas_Thwaites-...
1•o4c•17m ago•0 comments

Amazon to invest up to $25B in Anthropic as part of $100B cloud deal

https://www.reuters.com/technology/anthropic-spend-over-100-billion-amazons-cloud-technology-2026...
1•teleforce•17m ago•0 comments

Cocaine pollution gives salmon wanderlust

https://www.science.org/content/article/cocaine-pollution-gives-salmon-wanderlust
1•1659447091•17m ago•0 comments

Most "launch platforms" are built backwards (and it hurts solo founders)

https://buildfeed.co
1•moodiverse•18m ago•1 comments

Show HN: PrivacyScrubber - Local PII redactor for AI (works in Airplane Mode)

https://www.privacyscrubber.com/
1•privacyscrubber•20m ago•0 comments

Lipovive Helps Boost Metabolism and Burn Fat

https://www.morningstar.com/news/accesswire/1138075msn/lipovive-reviews-shocking-2026-report-what...
1•FinnMarden•20m ago•0 comments

Tim Cook Steps Down as CEO of Apple Inc

https://www.apple.com/community-letter-from-tim/
3•Koshima•22m ago•0 comments

Show HN: AI agents deploy apps autonomously (no accounts, no API keys)

https://nodeops.network/createos/docs/MPP/Overview
1•alex_creates•23m ago•0 comments

I analysed 17 years of fast food and coffee spending using OpenAI Codex

https://chrisflemming.com/blog/20260421-fast-food-coffee-spending-codex/
1•cpf_au•24m ago•0 comments

Trump signs order to accelerate access to psychedelic drug treatments

https://www.reuters.com/world/trump-announces-reforms-accelerate-access-psychedelic-drug-treatmen...
1•XzetaU8•27m ago•0 comments

Mason – A multi agent system in a container using Claude Code

https://github.com/Mason-Teams/mason-teams
1•dpark2026•28m ago•1 comments

Israeli soldiers using sexual assault to force Palestinians out of West Bank

https://www.theguardian.com/world/2026/apr/21/israeli-soldiers-using-sexual-assault-to-force-pale...
37•hebelehubele•29m ago•2 comments

TS Eliot's 20th-century nightmare

https://observer.co.uk/culture/books/article/ts-eliots-20th-century-nightmare
1•bryanrasmussen•37m ago•0 comments

18 Years Later, IPv6 Reaches Majority

https://pulse.internetsociety.org/en/blog/2026/04/18-years-later-ipv6-reaches-majority/
2•jruohonen•43m ago•1 comments

AI job scams are booming – and I was fooled by one. Here is how to avoid them

https://www.theguardian.com/money/2026/apr/21/how-to-avoid-ai-online-job-recruitment-scams
1•sorokod•44m ago•0 comments

Simple ways to make meetings work better for employees on the autism spectrum

https://apnews.com/article/autism-awareness-work-neurodivergent-meetings-89dfea1bd912184ab0628377...
1•petethomas•47m ago•0 comments

Good-egg – Trust scoring for GitHub PR authors based on contribution history

https://github.com/2ndSetAI/good-egg
1•zdw•49m ago•0 comments

I made a rap album about SRE/DevOps incidents and outages and it slaps

https://poddaddy5x9.vercel.app/
1•logicminds•49m ago•1 comments

Subtyping, Subclassing, and Trouble with OOP

https://okmij.org/ftp/Computation/Subtyping/
1•signa11•54m ago•0 comments

Malicious Packages Don't Fit the Vulnerability Intelligence Model

https://www.first.org/blog/20260420-Malicious-Packages-Dont-Fit
1•jruohonen•55m ago•0 comments

An information operating system powered by local files

https://galaxybrain.com
1•marcinignac•55m ago•1 comments

Foundations of Computer Science: C edition (1994) [pdf]

https://blough.ece.gatech.edu/3020/focs.pdf
1•nill0•56m ago•0 comments

Social media content creator boost

https://www.qten.ai/
1•bandishankar•56m ago•1 comments

Aiguard-scan – Find secrets and vulnerabilities in AI-generated code

https://github.com/Hephaestus-byte/agent-guard
2•Hephaestus-byte•1h ago•0 comments
Open in hackernews

Show HN: I built a Ruby gem that handles memoization with a ttl

https://github.com/mishalzaman/memo_ttl
48•hp_hovercraft84•12mo ago
I built a Ruby gem for memoization with TTL + LRU cache. It’s thread-safe, and has been helpful in my own apps. Would love to get some feedback: https://github.com/mishalzaman/memo_ttl

Comments

locofocos•12mo ago
Can you pitch me on why I would want to use this, instead of Rails.cache.fetch (which supports TTL) powered by redis (with the "allkeys-lru" config option)?
film42•12mo ago
Redis is great for caching a customer config that's hit 2000 times/second by your services, but even then, an in-mem cache with short TTL would make redis more tolerant to failure. This would be great for the in-mem part.
thomascountz•12mo ago
I'm not OP nor have I read through all the code, but this gem has no external dependencies and runs in a single process (as does activesupport::Cache::MemoryStore). Could be a "why you should," or a "why you should not" use this gem, depending on your use case.
hp_hovercraft84•12mo ago
Good question. I built this gem because I needed a few things that Rails.cache (and Redis) didn’t quite fit:

- Local and zero-dependency. It caches per object in memory, so no Redis setup, no serialization, no network latency. -Isolated and self-managed. Caches aren’t global. Each object/method manages its own LRU + TTL lifecycle and can be cleared with instance helpers. - Easy to use — You just declare the method, set the TTL and max size, and you're done. No key names, no block wrapping, no external config.

JamesSwift•12mo ago
For what its worth, ActiveSupport::CacheStore is a really flexible api that gives minimal contractual obligations (read_entry, write_entry, delete_entry is the entire set of required methods), but still allows you to layer specific functionality (eg TTL) on top with an optional 'options' param. You could get the best of both worlds by adhering to that contract and then people can swap in eg redis cache store if they wanted a network-shared store.

EDIT: see https://github.com/rails/rails/blob/main/activesupport/lib/a...

hp_hovercraft84•12mo ago
That's actually a really good idea! I'll definitely consider this in a future update. Thanks!
qrush•12mo ago
Congrats on shipping your first gem!!

I found this pretty easy to read through. I'd suggest setting a description on the repo too so it's easy to find.

https://github.com/mishalzaman/memo_ttl/blob/main/lib/memo_t...

hp_hovercraft84•12mo ago
As in identify where the source code is in the README?
zerocrates•12mo ago
I think they mean just set a description for the repo in github (set using the gear icon next to "About"), saying what the project is. That description text can come up in github searches and google searches.
film42•12mo ago
Nice! In rails I end up using Rails.cache most of the time because it's always "right there" but I like how you break out the cache to be a per-method to minimize contention. Depending on your workload it might make sense to use a ReadWrite lock instead of a Monitor.

Only suggestion is to not wrap the error of the caller in your memo wrapper.

> raise MemoTTL::Error, "Failed to execute memoized method '#{method_name}': #{e.message}"

It doesn't look like you need to catch this for any operational or state tracking reason so IMO you should not catch and wrap. When errors are wrapped with a string like this (and caught/ re-raised) you lose the original stacktrace which make debugging challenging. Especially when your error is like, "pg condition failed for select" and you can't see where it failed in the driver.

hp_hovercraft84•12mo ago
Thanks for the feedback! That's a very good point, I'll update the gem and let it bubble up.
JamesSwift•12mo ago
I thought ruby would auto-wrap the original exception as long as you are raising from a rescue block (i.e. as long as $! is non-nil). So in that case you can just

  raise "Failed to execute memoized method '#{method_name}'"
And ruby will set `cause` for you

https://pablofernandez.tech/2014/02/05/wrapped-exceptions-in...

film42•12mo ago
TIL! That's pretty cool. I still think if you have no reason to catch an error (i.e. state tracking, etc.) then you should not.
gurgeous•12mo ago
This is neat, thanks for posting. I am using memo_wise in my current project (TableTennis) in part because it allows memoization of module functions. This is a requirement for my library.

Anyway, I ended up with a hack like this, which works fine but didn't feel great.

   def some_method(arg)
     @_memo_wise[__method__].tap { _1.clear if _1.length > 100 }
     ...
   end
   memo_wise :some_method
JamesSwift•12mo ago
Looks good. Id suggest making your `get` wait to acquire the lock until needed. eg instead of

  @lock.synchronize do
    entry = @store[key]
    return nil unless entry

    ...
you can do

  entry = @store[key]
  return nil unless entry

  @lock.synchronize do
    entry = @store[key]
And similarly for other codepaths
chowells•12mo ago
Does the memory model guarantee that double-check locking will be correct? I don't actually know for ruby.
JamesSwift•12mo ago
I think it wouldnt even be a consideration on this since we arent initializing the store here only accessing the key. And theres already the check-then-set race condition in that scenario so I think it is doubly fine.
hp_hovercraft84•12mo ago
Good call, but I think I would like to ensure it remains thread-safe as @store is a hash. Although I will consider something like this in a future update. Thanks!
wood-porch•12mo ago
Will this correctly retrieve 0 values? AFAIK 0 is falsey in Ruby

``` return nil unless entry ```

chowells•12mo ago
No, Ruby is more strict than that. Only nil and false are falsely.
wood-porch•12mo ago
Doesn't that shift the problem to caching false then :D
RangerScience•12mo ago
you can probably always just do something like:

  def no_items?
    !items.present?
  end
  
  def items
    # something lone
  end

  memoize :items, ttl: 60, max_size: 10`
just makes sure the expensive operation results in a truthy value, then add some sugar for the falsey value, done.
madsohm•12mo ago
Since using `def` to create a method returns a symbol with the method name, you can do something like this too:

  memoize def expensive_calculation(arg)
    @calculation_count += 1
    arg * 2
  end, ttl: 10, max_size: 2

  memoize def nil_returning_method
    @calculation_count += 1
    nil
  end
hp_hovercraft84•12mo ago
This is why I love working with Ruby!
deedubaya•12mo ago
See https://github.com/huntresslabs/ttl_memoizeable for an alternative implementation.

For those who don’t understand why you might want something like this: if you’re doing high enough throughput where eventual consistency is effectively the same as atomic consistency and IO hurts (i.e. redis calls) you may want to cache in memory with something like this.

My implementation above was born out of the need to adjust global state on-the-fly in a system processing hundreds of thousands of requests per second.

kartik_malik•12mo ago
In React ?