Skip to content

Instantly share code, notes, and snippets.

@tabarra
tabarra / _README.md
Last active June 2, 2025 04:30
Bun script to Build & Deploy a docker container to Coolify via ECR private repo

Coolify ECR Deploy Script

Setup:

  1. Pre-requirements:
    1. The project needs to be a Docker container
    2. AWS ECR Repository
    3. Coolify Resource set up
    4. Bun needs to be installed on host machine
  2. Need to set up the coolify server to be able to pull your ECR images (detailed below).
  3. On your project's folder, create a .env with your config (template below).
@tabarra
tabarra / MinuteScheduler.ts
Created January 4, 2025 20:54
MinuteScheduler Class: Similar to setInterval, but aligned to the minute or a multiple of it, while also accounting for drift.
const roundToNextDivisible = (num: number, interval: number) => {
return Math.ceil(num / interval) * interval;
};
/**
* Similar to setInterval, but aligned to the minute or a multiple of it, while also accounting for drift.
*/
export default class MinuteScheduler {
public tsLast = Date.now();
@tabarra
tabarra / README.md
Created April 19, 2023 06:52
Listing FiveM/GTA5 vehicle model classes/types that diverge.

If you need to spawn a vehicle on the server side, you can use CreateVehicleServerSetter(), but the issue is that you need the vehicle type, but on the server there is no native to get it from a vehicle model.
In txAdmin this was initially "solved" by getting the vehicle class on the client and sending that to the server use it as a type when creating the vehicle. The logic used on the client is to check for the class on the vehClassNamesEnum table and assuming automobile for classes not on that table.

Later it was noticed that the server needs "type" instead of "class", and there is also no GetVehicleTypeFromName() on the client.
To solve this issue, it was created a lookup table to fix mismatched types.

This gist shows how to generate that table.
This must be run every now and then since new vehicles are added to the game on new DLC releases.

@tabarra
tabarra / admins.json
Last active February 28, 2025 05:58
Temporary admins file for txAdmin, please add it to txData/admins.json. The password is masterpassword123.
[
{
"name": "txmaster",
"master": true,
"password_temporary": true,
"password_hash": "$2a$12$JterWfFQx1abyi.OBKTIW.mOiHl7wrlyaTnz21SmygI20qO2xIdu2",
"providers": {},
"permissions": []
}
]