Skip to content

Instantly share code, notes, and snippets.

View hoangsonww's full-sized avatar
:octocat:
welcomeee

Son Nguyen hoangsonww

:octocat:
welcomeee
View GitHub Profile

URL Shortening Service

A URL shortening service transforms long URLs into concise, easy-to-share links. Think of services like TinyURL or Bitly. This project provides a RESTful API and a simple web interface for creating, managing, and tracking short URLs.


Table of Contents

  1. Introduction
  2. Features
@hoangsonww
hoangsonww / rag-system-demo.ipynb
Last active July 6, 2025 23:33
RAG-System-Demo.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hoangsonww
hoangsonww / recipe_sharing_app.rb
Last active December 20, 2024 15:02
A Ruby on Rails API for a Recipe Sharing Platform that supports user authentication, recipe management, commenting, and admin controls with token-based security.
# frozen_string_literal: true
require 'rails/all'
# Basic Application Setup
class RecipeSharingApp < Rails::Application
config.load_defaults 6.1
config.api_only = true
end
@hoangsonww
hoangsonww / controllers.go
Last active March 9, 2025 07:17
A comprehensive Go backend for a Library Management System using the Beego framework, providing API endpoints for managing books, authors, borrowers, and book borrowing/returning.
package main
import (
"encoding/json"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"time"
)
// BookController handles operations related to books
@hoangsonww
hoangsonww / blog_api.php
Last active December 20, 2024 15:03
A single-file PHP backend for a Blog Management API with user authentication, role-based access control, and CRUD operations for posts and comments using SQLite.
<?php
// Enable CORS and set content type
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
// SQLite database connection
$db = new PDO('sqlite:blog.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Initialize tables
@hoangsonww
hoangsonww / Blockchain.py
Created April 8, 2024 04:05
A basic blockchain structure in Python with proof-of-work consensus, transaction handling, and wallet functionalities.
import hashlib
import json
from time import time
import binascii
from collections import OrderedDict
from uuid import uuid4
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives import serialization
from cryptography.exceptions import InvalidSignature
@hoangsonww
hoangsonww / text_summarizer.py
Created March 14, 2024 07:42
Text Summarization with AI
from transformers import pipeline, T5Tokenizer
def summarize_text(text, max_length=130, min_length=30, model_name='t5-small'):
"""
Summarizes long texts using a pre-trained model from Hugging Face's Transformers.
This enhanced version includes functionality to handle large texts by breaking them
into manageable chunks, addressing the token limit constraint of the model.
Parameters:
- text: The text to be summarized.
@hoangsonww
hoangsonww / batch_rename_files.py
Created March 14, 2024 07:39
Batch File Renamer
import os
def batch_rename_files(directory, prefix):
"""
Renames all files in the given directory with the given prefix followed by a sequential number,
keeping their original file extensions intact. This can be useful for organizing a large number
of files in a systematic way, such as photos from an event, downloaded files, etc.
Parameters:
- directory: The path to the directory containing the files to be renamed.
@hoangsonww
hoangsonww / twoLetterCountryCodes.js
Created March 12, 2024 20:59
Two Letter Country Codes
const twoLetterCountryCodes = [
{ name: 'Afghanistan', code: 'AF' },
{ name: 'Albania', code: 'AL' },
{ name: 'Algeria', code: 'DZ' },
{ name: 'American Samoa', code: 'AS' },
{ name: 'Andorra', code: 'AD' },
{ name: 'Angola', code: 'AO' },
{ name: 'Anguilla', code: 'AI' },
{ name: 'Antarctica', code: 'AQ' },
{ name: 'Antigua and Barbuda', code: 'AG' },
@hoangsonww
hoangsonww / twoLetterLangCode.js
Created March 12, 2024 20:55
Two Letter Language Codes
const twoLetterLangCodes = [
{ "code": "aa", "name": "Afar" },
{ "code": "ab", "name": "Abkhazian" },
{ "code": "ae", "name": "Avestan" },
{ "code": "af", "name": "Afrikaans" },
{ "code": "ak", "name": "Akan" },
{ "code": "am", "name": "Amharic" },
{ "code": "an", "name": "Aragonese" },
{ "code": "ar", "name": "Arabic" },
{ "code": "as", "name": "Assamese" },