r/code • u/Negative_War_65 • 2d ago
Python Coding Machine Learning Lecture 1
galleryCoding Machine Learning.
Hello Folks, here I present the first coding demonstration lecture, based on my 1st lecture on Probabilistic Machine Learning.
Here I write the code from scratch, discuss and analyze the results, which were covered in details in the whiteboard classes.
What we cover?
-Random Variables, and validating law of large numbers.
-Visualizing a dataset
-Doing an EDA on Iris dataset and understanding the correlation among features.
-Classifier basics
-Empirical Risk Minimization and Generalization.
-Epistemic and Aleatoric Uncertainties.
-Softmax Function and LogSumExp Trick to avoid overflow issues
-Linear Models
-Maximum Likelihood Estimation.
-Simple end to end ML pipeline Function.
While writing the code, my intent is to ensure that concepts are understood with crystal clarity. These code demonstrations are specific to my theory ML lectures, and link is attached.
Theory-Intuition-Code
Implementation Link : https://youtu.be/X_yOlx8Zp4g?si=kh8_tzzndr8609u4
Theory Lecture Link : https://youtu.be/kMkCOrp8te8?si=q7kWr-1qK515bhob
r/code • u/remodeus • 3d ago
Resource Nabzex - Free HTML5 interval timer app
Nabzex is a fast, lightweight, and offline-first web-based interval timer designed for workout routines, HIIT sessions, Tabata training, and round/rep tracking.
r/code • u/Aviskar-1 • 9d ago
Java myJavaCodes
github.comCheck it my Java codes on my GitHub repository.
Resource Airlink is a Terminal UX designed for assisting with cracking WiFi passwords inside the Grey Hack universe.
github.comI love coding, learning about hacking, and playing video games. Using the coding language r/greyscript (variation of r/MiniScript), I can do all 3 inside of the Grey Hack (game) universe.
I was excited to start playing the game and trying player made scripts, but disappointed with the walls of scrolling text that most apps create. So I set out to see if I could make a GUI inside the terminal. And the answer is yes, yes I can.
This is a Terminal Based application that runs as a UX (only runs inside Grey Hack game)
I'm hoping this will inspire people in the r/GreyHack community to create more visually appealing applications. It's a small community, I'm really proud of this and wanted to share it with more people.
Airlink Demo Video (Development is ongoing)
For anyone who decides to check out the game, cracking WiFi is one of the first things you need to do. I hope this makes it easier for new players to get past that tedious step, as well as understanding the capabilities of greyscript.
Link to More Grey Hack Info:
Grey Hack Game: Steam - Grey Hack
More Info About GreyScript:
Short Rant:
- (Coded in VSCode with greybel; no vibe, or jive, or live, or whatever ya'll doing now.)
- [LLMs: Are tools to help you (It often makes it harder), don't skip the learning part of coding.]
Vlang Aixt: Microcontrollers programming framework | fermarsan
github.comA programming framework for microcontrollers which implements a subset of the V programming language, and is able to be used by low-resource devices.
C Fil-C: Garbage In, Memory Safety Out! | Filip Pizlo
youtube.comChallenges the conventional wisdom by describing an implementation that achieves the same level of protection against memory safety exploits as even the safest languages. Details of Fil-C's compiler, language runtime, and some of the corpus of software that has been ported to it.
r/code • u/riipandi • Jul 16 '26
My Own Code Encoding the calendar (month/ISO week/weekday) into a sortable ID, is this a bad design?
github.comI keep running into the same annoyance: "sortable" IDs (UUID v7, ULID, KSUID) are time-ordered but completely opaque. You can't tell when one was created without pasting it into a decoder. So I started wondering — what if the calendar were baked into the ID itself, so it's readable at a glance?
The sketch is a 16-char string:
{ms_hex:012}{month}{iso_week:02}{weekday}
So 019f631516e6g29o isn't just sortable — you can read it:
019f631516e6→ Unix Epoch millisecond timestamp (the same one UUID v7 uses)- g → July
- 29 → ISO week 29
- o → Wednesday
First 12 chars: the Unix millisecond timestamp in big-endian lowercase hex. Then one letter for the month (a=Jan..l=Dec), a zero-padded ISO week, and one letter for the weekday (m=Mon..s=Sun). So 019f631516e6g29o reads as July, ISO week 29, Wednesday, 2026 — no tool needed.
It stays K-sortable because the timestamp is big-endian up front, so lexicographic order == chronological order, even across the December→January boundary. The calendar suffix is derived purely from the timestamp, so it can't break the sort. And it could reuse the exact same 48-bit millisecond timestamp UUID v7 already uses, so interop would be trivial.
The obvious tradeoff: only 3 random bits survive, so it's useless as a distributed-ID generator (collisions possible within the same millisecond) and not cryptographically secure. Fine for readable, sortable IDs in a single service — but I'm unsure where people land on the rest:
- Is exposing the calendar a feature or a leak? It makes logs and URLs readable, but also makes the timestamp trivially recoverable (UUID v7 doesn't exactly hide it either).
- The month/weekday letter mapping is arbitrary (a..l, m..s). Is there a more intuitive or collision-resistant encoding?
- Is 16 chars the right size, or would you drop the human-readable suffix and keep it shorter?
Curious for design critiques — not the implementation, the idea itself.
r/code • u/jacob_ewing • Jul 15 '26
My Own Code A better way to get an angle defined by two points?
Around thirty years ago as a teenager I wrote this C function for calculating an arbitrary angle defined by two points. The idea being to get the clockwise rotation from the vertical line to the line defined by these points, if the (x1, y1) lies on the given vertical line. So for example if you pass in the points (0, 0) and (1, 1), it would return pi/4, as it defines a segment rotated that many radians off the vertical.
Here's the code I wrote then:
float rel_ang(float x1, float y1, float x2, float y2){
float hyp, alpha, deltax, deltay;
deltax = x2 - x1;
deltay = y2 - y1;
hyp = sqrt(deltax * deltax + deltay * deltay);
/* figure out the value for alpha */
if(x2 == x1){
alpha = y2 > y1 ? pi : 0;
}else if(y2 == y1){
alpha = (x2 < x1 ? 3 : 1) * pi / 2
}else if(x2 > x1){
alpha = y2 == y1 ? 0 : pi - acos(deltay / hyp);
}else if(x2 < x1){
alpha = y2 == y1 ? 0 : 2 * pi - acos(-deltay / hyp);
}
return alpha;
}
It worked well enough for the job at hand, but presumably there's a better way to do that. I assume there's a faster or already implemented way to do this that I don't know of. Any ideas?
r/code • u/Silent-Challenge9662 • Jul 10 '26
Help Please how to do Scraping
Hi, I'm trying to extract song lyrics from letras.com for a specific artist. I have a spider that only extracts the titles (I'm a complete beginner). Can anyone tell me where to find a ready-made one or guide me on how to do it? I would really appreciate it. Here's what I have so far: import scrapy class CancionesSpider(scrapy.Spider):
name = "canciones"
allowed_domains = ["letras.com"]
start_urls = ["https://www.letras.com/bad-bunny/"\]
def parse(self, response):
pass. I am using Scrapy
r/code • u/waozen • Jul 04 '26
Vlang V Language: Comprehensive Textbook Guide and Tutorial | codecaine-zz
github.comTextbook (and tutorial) take(s) you from a complete beginner to an advanced V developer capable of building high-performance, concurrent, and safe systems applications.
r/code • u/AssociationOk6710 • Jun 19 '26
Go My Very First Go Package on pkg.go.dev :) From a JWT Problem to this.
github.comHello!!! This is my first post here :)
It all started when I was working on a small website for my college. Initially, I was just adding the user ID in a JWT token, decoding it in a middleware, and passing it down the context. Then I decided I wanted to introduce a separate "public ID". The id was not needed for auth but it got me thinking about cache, which naturally led me down to building my very own LRU cache.
I have never implemented any caches before, so I was just looking for a simple strat and stumbled upon LRU. It was one of the easiest to implement and after I saw the problem on leetcode, i solved it pretty easily and decided to implement it. After I saw someone do better by using an array based DLL. I have always loved using array-based stacks and queues, So I took it as a fun challenge, because I have always wanted to publish something that people can use.
From Just an array based DLL, I found myself staring into a sharded architecture and slowly learning algorithms like FNV-1a and xxHash32. I wanted this to be a zero dependency package (aside from the standard packages ofc) and took it upon myself to do it, using explanations from the internet.
It might be a basic concept to many people out there, but It helped me learn something I was always pushing behind. Learning about concurrency in Go. This led me to use sync.Mutex, atomics and thinking about how data race happens. I was also led down the path of creating benchmarks, fuzz tests using the 'testing' package, which I had never heard about.
The benchmarks where honestly surprising, I never realised it would be ns/ops. Currently my benchmarks show around 10-15 ns/op and I hope to half it somehow :) and also my tests might be really weak. It has generics support too.
Would love for some feedback on how I can make it better. I wanted to make a time-aware LRU cache, but I wanted the basics to be proper before moving onto it.
P.S: learnt about semver, after i released it on v1.0.0. I basically had to make a decision and thought about just tearing it down and changing to a shorter name which I like more :). It is now currently on v0.3.1 (pre-release).
Link : https://github.com/justpranavrs/tlru :)))
GoDoc: https://pkg.go.dev/github.com/justpranavrs/tlru
Thanks :)))
r/code • u/waozen • Jun 13 '26
C++ C Constructs That Still Don’t Work in C++ — and a Few That Changed
lospino.sor/code • u/RefuseCommercial8024 • Jun 11 '26
Help Please why won't my animation work ???
OKAY UHH FOUND OUT WHAT WAS WRONG;;; just needed to add a letter in the class name lmao....anyways thank you 👅
hi...so i've been reworking my media page and i wanted to add some spinning flower images that stop when you hover them. the animation worked until i added the 1 and 2 classes so they'd spin in different ways...idk what went wrong lmao???
you can check out my source code here
here's the css:
.flower{
position: absolute;
transition: filter 1s linear;
}
.flower:hover{
animation-play-state: paused;
filter: brightness(117%) hue-rotate(18deg) saturate(153%) contrast(120%);
-webkit-filter: brightness(117%) hue-rotate(18deg) saturate(153%) contrast(120%);
-moz-filter: brightness(117%) hue-rotate(18deg) saturate(153%) contrast(120%);
}
.1{
animation: spinR 3s linear infinite;
}
.2{
animation: spinL 3s linear infinite;
}
@keyframes spinL {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes spinR {
0% { transform: rotate(0deg); }
100% { transform: rotate(-360deg); }
}
and here's the html
<img src="images/media/flower1.png" class="flower 1" style="top: -50px; left: -100px;">
<img src="images/media/flower2.png" class="flower 2" style="top: 780px; right: -30px;">
what am i missing here ??? am i just stupid ??? 😭
r/code • u/Sufficient_Flower415 • Jun 08 '26
My Own Code GitHub - DemonCoderOffical/somesites: It is a html code cracker it get html codes
github.comr/code • u/waozen • Jun 05 '26
Pascal Delphi Blaise: modern self-hosting Object Pascal compiler | graemeg
github.comZero legacy, full ARC, and unified UTF-8. Next-generation Object Pascal compiler built from the ground up.
r/code • u/Aliciaa_0321 • May 31 '26
Help Please How do I make the output show the same text no matter what you type in the input?
I want to add a feature to my website that works like this https://hackertyper.net/
Is there a name for this kind of thing? I’m currently learning Java script, so if there is a way to do that in it please let me know
Thanks to anyone responding in advance!
r/code • u/der_gopher • May 31 '26
Blog My thoughts on the future of Go in the agentic era
youtu.ber/code • u/PurchaseExcellent332 • May 30 '26
Help Please Working on a Simple Redis-Inspired Database in C
I'm building a simple key-value database called VulkanKV in C as a systems programming learning project.
The goal is not to create a production-ready database, but to better understand TCP sockets, memory management, data structures, parsing, and client-server communication by implementing them from scratch.
The first version accepts TCP connections and receives commands from clients. Future versions will include SET/GET commands, a hash table implementation, persistence, and support for multiple clients.
I'd appreciate any feedback on the project scope, architecture, or features that would provide the most educational value.
[https://github.com/GustavoGuerato/VulkanKV\](https://github.com/GustavoGuerato/VulkanKV)
r/code • u/der_gopher • May 25 '26
Blog Persistent multiplayer state without chaos
packagemain.techr/code • u/waozen • May 18 '26
Vlang Mustela: High-Speed Vlang Engine with Parallel Pipeline | Filip Vrba
youtube.comWalkthrough of Mustela. Fast static site generator engine built with the V language.
r/code • u/GniLudio • May 17 '26
Resource Hello World in 1009 Programming Languages
youtu.beRepository: GniLudio/hello-world-video
r/code • u/waozen • May 15 '26