Skip to content

Instantly share code, notes, and snippets.

View voratham's full-sized avatar
🤔
finding learning new thing ?

Voratham.Siri voratham

🤔
finding learning new thing ?
  • Thailand, Samut Prakarn
View GitHub Profile
@voratham
voratham / channel-breaking-out-from-select-and-wait.go
Last active March 5, 2023 18:17
example-go-concunrrecy-generator-func
package main
import (
"fmt"
)
func main() {
ch := make(chan int)
ch2 := make(chan int)
@voratham
voratham / k3d-create-cluster-no-traefik.sh
Created January 24, 2023 08:33 — forked from smijar/k3d-create-cluster-no-traefik.sh
k3d create cluster without traefik and serverlb
# Possibly obsolete: k3d create --name testcls1 --workers 3
k3d create --name testcls1 --workers 3 --server-arg "--no-deploy=traefik" --server-arg "--no-deploy=servicelb"
# UPDATE: in newer versions onwards, this has evolved to (thanks to comments below):
k3d cluster create --k3s-arg "--no-deploy=traefik@server:*"
class ApiClient {
final Dio dio;
final NetworkInfo networkInfo;
final FlutterSecureStorage secureStorage;
String? accessToken;
/// The base options for all requests with this Dio client.
final BaseOptions baseOptions = BaseOptions(
connectTimeout: 5000,
receiveTimeout: 3000,
@voratham
voratham / nearby-coordinates.sql
Created October 27, 2022 16:07 — forked from statickidz/nearby-coordinates.sql
Ordering with SQL by nearest latitude & longitude coordinates (MySQL & SQLite)
---
METHOD 1
This should roughly sort the items on distance in MySQL, and should work in SQLite.
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance.
---
SELECT *
FROM table
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC
@voratham
voratham / main.py
Created August 31, 2022 16:37
selenim-chrome-driver-profile
import os
from selenium import webdriver
path = os.getcwd()
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=/Users/voratham/Library/Application Support/Google/Chrome/Profile 1")
@voratham
voratham / ocr-simple-python.md
Last active August 31, 2022 16:31
Easy ocr read captcha simple

How to install

pipenv install opencv-python
pipenv install tesseract-ocr
pipenv install tesseract
# for mac
brew install tesseract
@voratham
voratham / index.js
Created April 13, 2022 15:16
js101-with-p-peck
console.log("hello world !")
var x = 2;
function test(){
x = 3
}
// function sum(a ,b){
// return a +b;
// }
@voratham
voratham / filebuffer.go
Created September 21, 2021 07:05 — forked from minikomi/filebuffer.go
Read file to buffered bytes buffer in chunks.
package main
import (
"bufio"
"bytes"
"fmt"
"io"
"log"
"os"
)
@voratham
voratham / input-stream.dart
Last active April 29, 2021 17:30
Dart Example with stream
import "dart:html";
import "dart:async";
void main() {
final InputElement input = querySelector("input");
final DivElement div = querySelector("div");
final validatorEmailFormatter =
new StreamTransformer.fromHandlers(handleData: (inputValue, sink) {
class Deck {
List<Card> cards = [];
Deck() {
var ranks = ["Ace", "Two", "Three", "Four", "Five"];
var suits = ["Diamonds", "Hearts", "Clubs", "Spades"];
for (var suit in suits) {
for (var rank in ranks) {