Skip to content

Instantly share code, notes, and snippets.

View hashcott's full-sized avatar
😅
Working from home

Nguyen Duc Hanh hashcott

😅
Working from home
View GitHub Profile
function initFacebookAdDownloader() {
// Queue to store pending GraphQL responses
const processingQueue = {
items: [],
isProcessing: false,
processDelay: 500, // Delay between processing items
async add(response) {
this.items.push(response);
if (!this.isProcessing) {
function initFacebookAdDownloader() {
// Queue to store pending GraphQL responses
const processingQueue = {
items: [],
isProcessing: false,
processDelay: 500, // Delay between processing items
async add(response) {
this.items.push(response);
if (!this.isProcessing) {
@hashcott
hashcott / config.ts
Created June 30, 2025 10:12
Crawl meta ad library
const config = {
urls: {
base: 'https://www.facebook.com',
},
defaultRequestHeaders: {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'accept-language': 'en-US,en;q=0.9',
'content-type': 'text/html; charset="utf-8"',
'cache-control': 'max-age=0',

image

Lưu ý:

  • KHACH_HANG: lưu trữ thông tin của khách hàng
  • PHONG: lưu trữ thông tin phòng karaoke
  • DICH_VU_DI_KEM: lưu trữ thông tin các dịch vụ đi kèm được cung cấp tại quán Karaoke.
  • DAT_PHONG: lưu trữ thông tin đặt phòng karaoke của khách hàng
  • CHI_TIET_SU_DUNG_DV: lưu trữ thông tin chi tiết khi khách hàng sử dụng các dịch vụ đi kèm.
  • PK: là các trường tham gia vào khóa chính của bảng

Bài 1: Để quản lý Thực tập nghề nghiệp của sinh viên, người ta xây dựng một cơ sở dữ liệu có tên là ThucTap gồm các sơ đồ quan hệ sau:

Khoa(makhoa char(10), tenkhoa char(30), dienthoai char(10)) GiangVien(magv int, hotengv char(30), luong decimal(5,2), makhoa char(10)) SinhVien(masv int, hotensv char(30), makhoa char(10), namsinh int, quequan char(30)) DeTai(madt char(10), tendt char(30), kinhphi int, NoiThucTap char(30)) HuongDan(masv int, madt char(10), magv int, ketqua decimal(5,2))

CREATE DATABASE ThucTap;

Bài 1

Idea: Greedy Cho một mảng các số nguyên không âm. Tìm ba phần tử trong mảng đó tạo thành một tam giác có chu vi lớn nhất.

Test Case

Input : {6, 1, 6, 5, 8, 4}
Output : 20
Input : {2, 20, 7, 55, 1, 33, 12, 4}
Output : Triangle formation is not possible.
Input: {33, 6, 20, 1, 8, 12, 5, 55, 4, 9}

Contracts

  • Hãy build một contract cho phép người khác donate ETH cho bạn
  • Hãy lưu lại lịch sử những người đã donation
  • Bạn có thể rút tiền về tài khoản của bạn (tài khoàn này được thiết lập khi contract được tạo)

Hãy thiết kế giao diện để có thể sử dụng contract (sử dụng ethers để kết nối)

// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// collection => OWNER
contract RonaldoNFT is ERC721, ERC721URIStorage, Ownable {
@hashcott
hashcott / highlow.sol
Last active April 2, 2024 14:54
Game High or Low
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/*
Requirements:
- Nạp tiền vào game ( lưu số dư của người dùng )
- Rút tiền về ví
- Owner nạp tiền
- highLow ( number, số cược )
- random
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
contract Token {
mapping (address => uint) public balances;
mapping (address => mapping (address => uint)) public allowances;
uint public totalSupply;
address public foundation;
string public name = "LUAGA";