Skip to content

Instantly share code, notes, and snippets.

View abeldantas's full-sized avatar
🔮
Yes!

Abel Dantas abeldantas

🔮
Yes!
  • Kronoverse
  • Portugal
View GitHub Profile
@abeldantas
abeldantas / SplashInitializer.cs
Last active January 8, 2024 17:33
Unity Splash Optimization with Priority-based and Thread-Aware Initialization
/// <summary>
/// This is the dependency or subsystem that needs to be initialized before the first scene
/// </summary>
public interface IInitializable
{
bool IsInitialized { get; }
bool CanInitializeAsynchronously { get; }
void Initialize();
event Action OnInitialized;
}
@abeldantas
abeldantas / GitCommands.md
Last active January 8, 2024 15:37
Common Git Commands

See history between A and B

history | nl | sed -n '265,275p'

@abeldantas
abeldantas / tif_to_png.py
Created January 1, 2024 14:57
TIF to PNG Converter
from PIL import Image
import os
import sys
def convert_tif_to_png(src_path, dest_path):
if not os.path.exists(dest_path):
os.makedirs(dest_path)
for root, dirs, files in os.walk(src_path):
for file in files:
@abeldantas
abeldantas / nested_extension_copier.py
Last active January 1, 2024 14:38
Copy files with extensions nested in path
"""
Nested Extension Copier: A Python script to recursively copy files with specified extensions
from a source directory to a destination directory. It accepts multiple extensions as command-line
arguments, allowing for flexible and targeted file copying. Ideal for organizing files or selective backups.
"""
import os
import shutil
import sys
@abeldantas
abeldantas / extension_finder.py
Created January 1, 2024 14:25
File extension finder in path
import os
import sys
def find_unique_extensions(path):
"""
Recursively finds and returns a set of unique file extensions in the given directory.
:param path: Path of the directory to search in.
:return: Set of unique file extensions.
"""
@abeldantas
abeldantas / SetupSonarqube.md
Last active March 27, 2024 15:23
How to Setup Sonarqube

How to Install SonarQube Community Edition on Linux

1. Install Java & PostgreSQL

sudo apt update
sudo apt install openjdk-17-jre postgresql postgresql-contrib

2. Download SonarQube Community Edition

@abeldantas
abeldantas / UniTaskExample.cs
Last active November 14, 2023 16:04
No Fire and Forget Tasks in Unity
using System;
using System.Collections;
using System.Threading;
using Cysharp.Threading.Tasks;
using UnityEngine;
using Awaiter = Cysharp.Threading.Tasks.UniTask.Awaiter;
/// <summary>
/// Coroutines are great, and if we can fulfill all requirements using them, then good, no need to mess with Tasks!
///
@abeldantas
abeldantas / inspect-aab.sh
Created October 26, 2023 15:22
AAB Processing Script for Android Development
#!/bin/bash
# Usage: ./script.sh [file1.aab file2.aab ...]
# If no arguments are provided, the script will find and process all .aab files in the current directory.
# The script performs the following steps for each .aab file:
# 1. Builds an .apks file using bundletool.
# 2. Deletes the original .aab file.
# 3. Renames the .apks to .zip.
# 4. Decompresses the .zip into a new directory.
# 5. Deletes the .zip file.
@abeldantas
abeldantas / FeatureTests.cs
Last active October 9, 2023 08:15
Quickstart Unity C# test template. Not perfect, but gets you testing now.
using System.Collections;
using System.Threading.Tasks;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
// Namespace should mirror the implementation namespace with a '.Tests' suffix.
// If the implementation is under 'MyCompany.FeatureScope', then tests should be 'MyCompany.Tests.FeatureScope'.
namespace MyCompany.Tests.FeatureScope
{
@abeldantas
abeldantas / Singleton.cs
Last active October 27, 2023 08:21
Basic singleton for C# Unity
using System;
using UnityEngine;
public abstract class Singleton<T> : MonoBehaviour, IDisposable where T : Singleton<T>
{
public static T Instance { get; protected set; }
void Awake()
{
if ( Instance != null && Instance != this )