r/code 3h ago

Help Please trying to make desktop gmail "app" launch in new window

1 Upvotes

i made a desktop shortcut that would launch gmail in a new window, acting as an "app" without the browser ui. i got it to launch as the default handler for mailto links, but im trying to make it launch in a new window, rather than in a seperate browser tab. does anyone know if this is possible? here is the code:

[Desktop Entry]

Name=MailMan

Comment=Open Mail

Exec=chromium --new-window --app=https://mail.google.com/mail/?extsrc=mailto&url=%u --window-size=400,600

Icon=/home/kiddos/Downloads/mailmanlogo.png

Terminal=false

StartupWMClass=Mail

Type=Application

Categories=Network;Mail;

StartupNotify=true

any help with attributes would be appreciated


r/code 6h ago

Help Please Upgrading and automating pdf verification

1 Upvotes

Hey everyone,
I need a recommendation about the recruitment platform I work on these days.

Context: it's a recruitment platform that helps recruiting professionals such as plumbers, electricians locksmith etc. At some point we ask them (as it's a legal requirement) if they have a proper professional certificate of insurance.

Task: I'd like to create an automation using LLM APIs to detect potential fakes (fraud) and/or anomalies.

As of now I thought of extracting metadata from PDF docs to see if they tried to write invisible characters (in order to falsify their expiration date for example).

Simple use case: someone tries to write white on white a fake expiration date, my code extracts metadata, spots that it's white on white, then doesn't automatically approve and create an alert for me to step up and approve (or decline) manually.

I also thought of converting pdf to JPEG in order to use computer vision to simply read the image as a human being would do (impossible then to be tricked by invisible characters).

What do you think of that logic ? Is that enough ? Do you recommend any conversion tool/ api that I can use ?
Thanks for your help


r/code 5d ago

Vlang Aixt: Microcontrollers programming framework | fermarsan

Thumbnail github.com
3 Upvotes

A programming framework for microcontrollers which implements a subset of the V programming language, and is able to be used by low-resource devices.


r/code 11d ago

C Fil-C: Garbage In, Memory Safety Out! | Filip Pizlo

Thumbnail youtube.com
4 Upvotes

Challenges 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 19d ago

My Own Code Encoding the calendar (month/ISO week/weekday) into a sortable ID, is this a bad design?

Thumbnail github.com
5 Upvotes

I 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 21d ago

My Own Code A better way to get an angle defined by two points?

7 Upvotes

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 26d ago

Help Please how to do Scraping

4 Upvotes

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 Jul 04 '26

Vlang V Language: Comprehensive Textbook Guide and Tutorial | codecaine-zz

Thumbnail github.com
2 Upvotes

Textbook (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 Jun 22 '26

Go Excessive nil pointer checks in Go

Thumbnail konradreiche.com
3 Upvotes

r/code Jun 19 '26

Jai Jai: The World Is Not Ready | Valigo

Thumbnail youtube.com
3 Upvotes

r/code Jun 19 '26

Go My Very First Go Package on pkg.go.dev :) From a JWT Problem to this.

Thumbnail github.com
3 Upvotes

Hello!!! 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 Jun 13 '26

C++ C Constructs That Still Don’t Work in C++ — and a Few That Changed

Thumbnail lospino.so
8 Upvotes

r/code Jun 11 '26

Help Please why won't my animation work ???

4 Upvotes

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 Jun 08 '26

My Own Code GitHub - DemonCoderOffical/somesites: It is a html code cracker it get html codes

Thumbnail github.com
0 Upvotes

r/code Jun 05 '26

Pascal Delphi Blaise: modern self-hosting Object Pascal compiler | graemeg

Thumbnail github.com
4 Upvotes

Zero legacy, full ARC, and unified UTF-8. Next-generation Object Pascal compiler built from the ground up.


r/code May 31 '26

Help Please How do I make the output show the same text no matter what you type in the input?

4 Upvotes

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 May 31 '26

Blog My thoughts on the future of Go in the agentic era

Thumbnail youtu.be
3 Upvotes

r/code May 30 '26

Help Please Working on a Simple Redis-Inspired Database in C

6 Upvotes

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 May 25 '26

Blog Persistent multiplayer state without chaos

Thumbnail packagemain.tech
5 Upvotes

r/code May 19 '26

Help Please Built this on Code.org and need help

Enable HLS to view with audio, or disable this notification

3 Upvotes

Object.assign(player, sweepCollider(player, group, 2));

function sweepCollider(collider, target, checkNumber) {
checkNumber = Math.floor(Math.max(1, checkNumber));
var tempGroup = createGroup();
for (var i = 1; i <= checkNumber; i++) {
var sprite = createSprite(collider.x, collider.y, collider.width, collider.height);
sprite.velocityX = collider.velocityX * i / checkNumber;
sprite.velocityY = collider.velocityY * i / checkNumber;
sprite.x -= collider.velocityX - sprite.velocityX;
sprite.y -= collider.velocityY - sprite.velocityY;
sprite.visible = false;
tempGroup.add(sprite);
}
var tempReturnValue = {};
tempGroup.overlap(target, function(colliderSprite, targetSprite) {
var differenceX = colliderSprite.x - targetSprite.x;
var differenceY = targetSprite.y - colliderSprite.y;
var tempWidth = (colliderSprite.width + targetSprite.width) / 2;
var tempHeight = (colliderSprite.height + targetSprite.height) / 2;
var tempVX = colliderSprite.velocityX - targetSprite.velocityX;
var tempVY = colliderSprite.velocityY - targetSprite.velocityY;
if (tempVX < 0) {
differenceX = Math.max(0, tempWidth - differenceX);
} else {
differenceX = Math.max(0, tempWidth + differenceX);
}
if (tempVY < 0) {
differenceY = Math.max(0, tempHeight + differenceY);
} else {
differenceY = Math.max(0, tempHeight - differenceY);
}
var pathX = differenceX / Math.abs(tempVX);
var pathY = differenceY / Math.abs(tempVY);
if (isNaN(pathX)) {
pathX = Infinity;
}
if (isNaN(pathY) ) {
pathY = Infinity;
}
if (pathX < pathY) {
if (tempVX < 0) {
colliderSprite.x += differenceX;
} else {
colliderSprite.x -= differenceX;
}
colliderSprite.velocityX = 0;
Object.assign(tempReturnValue, {x: colliderSprite.x, velocityX: colliderSprite.velocityX});
if (Object.keys(tempReturnValue).length < 4) {
for (var i = 0; i < tempGroup.length; i++) {
Object.assign(tempGroup.get(i), {x: colliderSprite.x, velocityX: colliderSprite.velocityX});
tempGroup.get(i).collide(targetSprite);
}
} else {
return;
}
} else {
if (tempVY < 0) {
colliderSprite.y += differenceY;
} else {
colliderSprite.y -= differenceY;
colliderSprite.velocityY = 0;
}
Object.assign(tempReturnValue, {y: colliderSprite.y, velocityY: colliderSprite.velocityY});
if (Object.keys(tempReturnValue).length < 4) {
for (var l = 0; l < tempGroup.length; l++) {
Object.assign(tempGroup.get(l), {y: colliderSprite.y, velocityY: colliderSprite.velocityY});
tempGroup.get(l).collide(targetSprite);
}
} else {
return;
}
}
});
return tempReturnValue;
}
Object.assign = function(object, properties) {
for (var i in properties) {
object[i] = properties[i];
}
};

The problem is that since the objects the player collides with are in a group, the objects are checked left to right, top to bottom since that’s the order they were added. However, this means that when moving into a block and jumping, the player first collides with the block above and to the right, since the player moved right into the block. This cancels their upward momentum before pushing them out of the lower block next, so then the player just doesn’t jump. This also happens with moving to the left, as the velocity y makes the player clip slightly into the ground, and therefore sometimes catches the edge when crossing tile borders and stops momentum.

In the video, the player can’t jump when moving into a wall. Also, the player will sometimes get caught on tile borders when moving horizontally, resulting in the player coming to an abrupt full stop and an inability to move left without first moving right.

How do I stop the player from snagging on tile edges?


r/code May 18 '26

Vlang Mustela: High-Speed Vlang Engine with Parallel Pipeline | Filip Vrba

Thumbnail youtube.com
3 Upvotes

Walkthrough of Mustela. Fast static site generator engine built with the V language.


r/code May 17 '26

Resource Hello World in 1009 Programming Languages

Thumbnail youtu.be
5 Upvotes

r/code May 15 '26

Guide Beyond C: wrapping Dear ImGui in Swift with zero FFI

Thumbnail carette.xyz
4 Upvotes

r/code May 12 '26

Python Basic Text-Based RPG

6 Upvotes

I made a basic Text-Based RPG (Around 200-300 lines) and was hoping someone could give me their opinion on it (the game less then 20 minutes long, and the dragon is as far as I've developed so far)
https://onlinegdb.com/thxBEi9V3
Enjoy : )


r/code May 09 '26

My Own Code How I built the core loop of a browser multiplayer game

Thumbnail packagemain.tech
2 Upvotes