Skip to content

Instantly share code, notes, and snippets.

View kien-ngo's full-sized avatar
🎯
Focusing

Kien Ngo kien-ngo

🎯
Focusing
View GitHub Profile
@kien-ngo
kien-ngo / ubuntu-server-install-guide.sh
Last active July 14, 2025 12:48
Ubuntu Server installation
# First, follow the installation steps here: https://chriskalos.notion.site/The-0-Home-Server-Written-Guide-5d5ff30f9bdd4dfbb9ce68f0d914f1f6#21db7c9525b046aaade33d538e197175
# I will not be following the static-IP section in the post, since I will be using Tailscale instead
# To run this Gist:
# curl -sSL https://gist.github.com/kien-ngo/497238acc157ae76c11107ab46c2fd63/raw | bash
##### Script execution starts #####
#Start ssh immediately so you can SSH in from another machine with GUI and web browsers so that you can copy stuff more easily
sudo systemctl start ssh
# Start SSH on boot
@kien-ngo
kien-ngo / hls.sh
Created November 13, 2024 04:40 — forked from stenuto/hls.sh
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
@kien-ngo
kien-ngo / multicall3.ts
Created July 28, 2024 12:51
multicall3 example
import { client } from "@/components/client";
import {
encode,
getContract,
prepareContractCall,
sendAndConfirmTransaction,
} from "thirdweb";
import { avalancheFuji } from "thirdweb/chains";
import { aggregate3 } from "thirdweb/extensions/multicall3";
import { privateKeyToAccount } from "thirdweb/wallets";
@kien-ngo
kien-ngo / getOwnedERC1155s.ts
Last active June 11, 2024 16:36
thirdweb custom extension: getOwnedERC1155s
export type GetERC1155sParams = {
/**
* Which tokenId to start at.
*/
start?: number;
/**
* The number of NFTs to retrieve. Defaults to 100
*/
count?: number;
/**
@kien-ngo
kien-ngo / getOwnedERC721s.ts
Last active September 3, 2024 02:52
thirdweb custom extension: getOwnedERC721s
import {
ADDRESS_ZERO,
type NFT,
type BaseTransactionOptions,
type Hex,
} from "thirdweb";
import { getOwnedTokenIds, isERC721 } from "thirdweb/extensions/erc721";
export type GetERC721sParams = {
owner: string;
@kien-ngo
kien-ngo / USDCReceiver_HardCoded.sol
Last active January 6, 2023 00:46
USDC (Polygon) Receiver Contract (Hard-coded version)
pragma solidity ^0.8.17;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/utils/SafeERC20.sol";
contract USDCPolygonReceiver {
SafeERC20 public token; // Syntax is wrong here
// This is the USDC contract address on Polygon, hard-coded
address public usdcContractAddress = 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174;
@kien-ngo
kien-ngo / USDCReceiver.sol
Created January 6, 2023 00:44
USDC (Polygon) Receiver contract
pragma solidity ^0.8.17;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/utils/SafeERC20.sol";
contract USDCPolygonReceiver {
SafeERC20 public token; // Syntax is wrong here?!
// This is the USDC contract address on Polygon, hard-coded
address public usdcContractAddress = 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;