Skip to content

Instantly share code, notes, and snippets.

View ttm62's full-sized avatar
🎯
Focusing

ttm62 ttm62

🎯
Focusing
  • Ha Noi - Viet Nam
View GitHub Profile
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder, StandardScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score
import random
@ttm62
ttm62 / format.sh
Created February 27, 2025 16:57 — forked from garethrees/format.sh
Format USB drive from the command line macOS
diskutil list
diskutil unmountDisk /dev/disk2
diskutil eraseDisk FAT32 SANDISK /dev/disk2
@ttm62
ttm62 / telesh.sh
Last active July 14, 2024 03:50
generate ssh id rsa key and upload to telegram bot
#!/bin/bash
# Prompt for key name and email
read -p "Enter SSH key name (without extension): " KEY_NAME
read -p "Enter your email address: " EMAIL
# Variables
BOT_TOKEN="YOUR_BOT_TOKEN"
CHAT_ID="YOUR_CHAT_ID"
KEY_PATH="$HOME/.ssh/$KEY_NAME"

Rocky Linux 9 - Web Server Installation

Notice

This cheatsheet assumes the user is knowledgeable about bare installations of virtual private servers on cloud providers and is looking for quick but comprehensive instructions.

Some trivial commands might be missed or skipped.
However, this document can also work as quick tutorial for newcomers to the RHEL eco-system.

Initial System Setup

@ttm62
ttm62 / CouponViewPlayground.swift
Created April 22, 2024 10:26 — forked from jeffersonsetiawan/CouponViewPlayground.swift
Playground for Coupon like View (Concaved view)
import UIKit
import PlaygroundSupport
let view = UIView(frame: CGRect(x: 0, y: 0, width: 375, height: 647))
view.backgroundColor = UIColor.white
let shadowView = UIView(frame: CGRect(x:50, y: 50, width:250, height:250))
view.addSubview(shadowView)
let someView = UIView(frame: CGRect(x:50, y: 50, width:250, height:250))
someView.backgroundColor = UIColor.white
@ttm62
ttm62 / CenterItemInCollectionView.playground
Created January 5, 2024 03:28 — forked from ylem/CenterItemInCollectionView.playground
Scrolling item on a horizontal UICollectionView, stopped item on center of screen.
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
class WLCollectionCell: UICollectionViewCell {
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@ttm62
ttm62 / WIN10.MD
Created December 17, 2023 06:01 — forked from q-hung/WIN10.MD
How Make a Windows 10 USB Using Your Mac - Build a Bootable ISO From Your Mac's Terminal

Most new PCs don't come with DVD drives anymore. So it can be a pain to install Windows on a new computer.

Luckily, Microsoft makes a tool that you can use to install Windows from a USB storage drive (or "thumbdrive" as they are often called).

But what if you don't have a second PC for setting up that USB storage drive in the first place?

In this tutorial we'll show you how you can set this up from a Mac.

Step 1: Download the Windows 10 ISO file

You can download the ISO file straight from Windows. That's right - everything we're going to do here is 100% legal and sanctioned by Microsoft.

@ttm62
ttm62 / rss_urls.txt
Created December 12, 2023 04:32 — forked from miguelmota/rss_urls.txt
Cryptocurrency news RSS feeds
https://thedefiant.io/feed/
https://www.coindesk.com/arc/outboundfeeds/rss/?outputType=xml
https://cointelegraph.com/rss
https://cryptopotato.com/feed/
https://cryptoslate.com/feed/
https://cryptonews.com/news/feed/
https://smartliquidity.info/feed/
https://finance.yahoo.com/news/rssindex
https://www.cnbc.com/id/10000664/device/rss/rss.html
https://time.com/nextadvisor/feed/
/*
Before Septemper 15 2018, Vietnam has phone number start with 09*, 01(2|6|8|9).
After that, the phone number can start with 03, 05, 07 or 08.
So this function provide a way to validate the input number is a Vietnamese phone number
*/
function isVietnamesePhoneNumber(number) {
return /(03|05|07|08|09|01[2|6|8|9])+([0-9]{8})\b/.test(number);
}
@ttm62
ttm62 / tune.md
Created October 1, 2023 16:24 — forked from phiresky/tune.md
SQLite performance tuning

You can scale a SQLite database to multiple GByte in size and many concurrent readers by applying the below optimizations.

Run these every time you connect to the db

(some are applied permanently, but others are reset on new connection)

pragma journal_mode = WAL;

Instead of writing directly to the db file, write to a write-ahead-log instead and regularily commit the changes. Allows multiple concurrent readers, and can significantly improve performance.