Skip to content

Instantly share code, notes, and snippets.

View abeldantas's full-sized avatar
🔮
Yes!

Abel Dantas abeldantas

🔮
Yes!
View GitHub Profile
@abeldantas
abeldantas / txn.json
Created January 22, 2022 18:21
Bitcoin transaction. vout are the transaction outputs. vin are the inputs. The scriptPubKey on the vouts will be unlocked with scriptSig of vin of a future transaction.
{
"version": 1,
"locktime": 0,
"vin": [
{
"txid": "7957a35fe64f80d234d76d83a2a8f1a0d8149a41d81de548f0a65a8a999f6f18",
"vout": 0,
"scriptSig" : "3045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e3813[ALL] 0484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adf",
"sequence": 4294967295
}
@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 )
@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 / 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 / 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 / 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 / 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 / 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 / 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 / GitCommands.md
Last active January 8, 2024 15:37
Common Git Commands

See history between A and B

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