Skip to content

Instantly share code, notes, and snippets.

View sonnguyen9800's full-sized avatar
💥
Doing Projects

Son Nguyen Hoang sonnguyen9800

💥
Doing Projects
View GitHub Profile
@sonnguyen9800
sonnguyen9800 / cgp.md
Created June 30, 2024 08:44 — forked from notnotrobby/cgp.md
List of free resources to study computer graphics programming.
@sonnguyen9800
sonnguyen9800 / BaseSingleton.cs
Created June 14, 2024 00:11
GodotSingleton
using Godot;
using System;
public abstract partial class BaseSingleton<T> : Node where T : Node
{
private static T _instance = null;
public static T Instance => _instance;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
@sonnguyen9800
sonnguyen9800 / Tool_ParseCSV.py
Created May 31, 2024 07:35
Tool_ParseCSV.py
import csv
def filter_and_print_columns(filename, column_names, filename_output):
"""
This function reads a CSV file, filters and prints data from specified columns.
Args:
filename: The path to the CSV file.
column_names: A list of column names to print data from.
@sonnguyen9800
sonnguyen9800 / file.cs
Created January 14, 2024 03:53
Batch Convert Unity Scene into Prefab
public class Tool: EditorWindow
{
[MenuItem("Tool/Create Prefab", false, -10)]
private static void CreatePrefab(UnityEditor.MenuCommand command)
{
GameObject selectedOb = (GameObject)command.context;
Transform selectedTransform = selectedOb.transform;
GameObject rootObject = selectedTransform.root.gameObject;
@sonnguyen9800
sonnguyen9800 / gist:96dbed6876a8f17fa8066a6bdde94de9
Created December 16, 2023 16:52
[Godot] Parse String to Enum.gd
func ParseStringToEnum(enum_type: Dictionary, string_value: String) -> int:
var clone = enum_type.duplicate()
var keys = clone.keys()
var index = keys.find(string_value)
if index != -1:
return index
else:
print("String not found in enum.")
return -1
@sonnguyen9800
sonnguyen9800 / RemoveCalibreBookDuplicates
Created May 10, 2023 18:00
Remove duplicate books (book folder) in a book directory. Require you to use "Find Duplicate" plugin first.
import os
import shutil
# Script to remove duplicate books in Calibre
# 1. Use Calibre's "Find Duplicate" plugin & run check (binary check) to remove all binary files that are duplicated
# 2. Run this script, point to the book directory.
# How it works?
# - Duplicated folders have no ebook format. They only has 2 files: image (book cover) & metadata files.
# - This script purge all folders that has less than or equal to 2 files.
#
@sonnguyen9800
sonnguyen9800 / UIFadeinTmpro.cs
Created June 7, 2022 03:07
Unity: Make text (TMPro) fade-in letter by letter
/*
* Source: https://forum.unity.com/threads/have-words-fade-in-one-by-one.525175/
*/
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class FadeinTxtSon : MonoBehaviour
@sonnguyen9800
sonnguyen9800 / CustomTreeTraversal
Last active May 10, 2023 18:01
Custom Tree Traversal, C#
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1
{
public class FrameContainer
{
public Frame FirstFrame;
@sonnguyen9800
sonnguyen9800 / UnstringlifyJsonFile.py
Last active May 10, 2023 18:02
Unstringlify Json file (Python)
import json
file_path = "file_path.txt"
file_path_output = "file_path_output.json"
f = open(file_path, "r", encoding='utf-16')
data_raw = f.read()
data_raw = data_raw.replace('\\', '')
data_raw = data_raw.replace('"{', '{')
data_raw = data_raw.replace('}"', '}')