Reddit Programming
199 subscribers
1.22K photos
126K links
I will send you newest post from subreddit /r/programming
Download Telegram
Understanding CPUs by building one in Kotlin
https://www.reddit.com/r/programming/comments/1s9r0nf/understanding_cpus_by_building_one_in_kotlin/

<!-- SC_OFF -->In order to understand how CPUs work internally I decided to build a small 16-bit CPU emulator entirely in Kotlin. It includes: A custom ISA (RISC/MIPS-inspired), Registers, Stack, Flags Instruction encoding/decoding ALU operations, branching and simple assembler I also wrote two detailed blog posts explaining the whole process step-by-step: ๐Ÿ‘‰ Part 1 - Understanding how a CPU works: https://bloder.io/cpu-from-scratch-part-1 ๐Ÿ‘‰ Part 2 - Using Kotlin to create a CPU emulator: https://bloder.io/cpu-from-scratch-part-2 And hereโ€™s the full source code: ๐Ÿ‘‰ https://github.com/bloderxd/kotlin-cpu <!-- SC_ON --> submitted by /u/_Bloder (https://www.reddit.com/user/_Bloder)
[link] (https://bloder.io/cpu-from-scratch-part-1) [comments] (https://www.reddit.com/r/programming/comments/1s9r0nf/understanding_cpus_by_building_one_in_kotlin/)
chronex - an Open-source social media scheduler
https://www.reddit.com/r/programming/comments/1sb4hwt/chronex_an_opensource_social_media_scheduler/

<!-- SC_OFF -->Over the past few weeks, I've been building a platform where users can connect their social accounts and automate content posting. So I built Chronex, an open-source alternative to paid content schedulers. Tech Stack Web/Platform: Next.js, tRPC, Drizzle, Better Auth Media Storage: Backblaze B2 Scheduling & Posting: Cloudflare Workers & Queues Github (https://github.com/prncexe/chronex) <!-- SC_ON --> submitted by /u/_Introvert_boi (https://www.reddit.com/user/_Introvert_boi)
[link] (https://chronex.princecodes.tech/) [comments] (https://www.reddit.com/r/programming/comments/1sb4hwt/chronex_an_opensource_social_media_scheduler/)
Using CEL's now() to enforce dependency cooldown periods - block packages published in the last N hours
https://www.reddit.com/r/programming/comments/1sbb7jv/using_cels_now_to_enforce_dependency_cooldown/

<!-- SC_OFF -->Supply chain attacks often rely on speed that is publish a malicious version, let automated builds pull it before detection catches up. One defense is a cooldown period : refuse any dependency published within the last N hours. CEL (Common Expression Language) doesn't expose now() by default since it's designed to be hermetic. This article actually walks through registering a custom now() function binding that returns the current UTC timestamp, using duration arithmetic to compare against package_published_at, and using the has() macro to handle packages so new they haven't been indexed yet - which is the edge case that will bite you if you miss it. <!-- SC_ON --> submitted by /u/BattleRemote3157 (https://www.reddit.com/user/BattleRemote3157)
[link] (https://safedep.io/writing-time-based-policies-in-vet-cel/) [comments] (https://www.reddit.com/r/programming/comments/1sbb7jv/using_cels_now_to_enforce_dependency_cooldown/)
I implemented Raft, a KV store, and a sharded system in Go (MIT 6.5840)
https://www.reddit.com/r/programming/comments/1sbdk50/i_implemented_raft_a_kv_store_and_a_sharded/

<!-- SC_OFF -->I recently completed the labs from MIT 6.5840 Distributed Systems and implemented everything in Go, including: Raft consensus algorithm A replicated Key/Value store A sharded KV system with dynamic reconfiguration The implementation focuses a lot on concurrency and failure handling: goroutines for RPC handling and background tasks channels for coordination between Raft and the state machine dealing with unreliable networks (dropped / delayed / out-of-order RPCs) Some interesting challenges: ensuring commitIndex never goes backward under out-of-order RPC responses handling retries safely with client/request IDs (idempotency) keeping deduplication state consistent across snapshots and shard transfers I wrote a detailed README explaining both the design and the tricky edge cases I encountered. <!-- SC_ON --> submitted by /u/am0123 (https://www.reddit.com/user/am0123)
[link] (https://github.com/abdellani/mit-6.5840-labs) [comments] (https://www.reddit.com/r/programming/comments/1sbdk50/i_implemented_raft_a_kv_store_and_a_sharded/)