Skip to content

Instantly share code, notes, and snippets.

View kittinan's full-sized avatar
🇹🇭
|||

Kittinan kittinan

🇹🇭
|||
View GitHub Profile
# pip install asyncio websockets
import asyncio
import binascii
import random
import string
import struct
import websockets
@kittinan
kittinan / index.html
Last active September 17, 2024 17:00
hippo game by ChatGPT o1-preview use wsad to control
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Baby Pygmy Hippopotamus Game</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
#score {
position: absolute;
@kittinan
kittinan / wireguard.md
Created October 7, 2023 13:39
Ubuntu 22.04 add wireguad config file to network manager

Ubuntu 22.04 add wireguad config file to network manager.

nmcli connection import type wireguard file YourConfigFile.conf
@kittinan
kittinan / yolov8_virtualcam.py
Last active September 21, 2023 16:54
Ultralytics YOLOv8 object detection model to detect objects in a video stream from a webcam and stream the annotated video to a virtual camera device.
"""
pip install ultralytics pyvirtualcam
Enable virtual camera on Linux:
modprobe v4l2loopback devices=1 max_buffers=2 exclusive_caps=1 card_label="VirtualCam"
# Remove v4l2
modprobe -r v4l2loopback
"""
@kittinan
kittinan / cloudflare_tunnel.md
Last active December 20, 2021 04:40
Cloudflare tunnel
@kittinan
kittinan / tunnel-jupyter.md
Last active August 17, 2021 14:34
ssh tunnel to access jupyter notebook server

Server

  • run jupyter notebook
jupyter notebook
  • do not forget check ssh server config /etc/ssh/sshd_config
@kittinan
kittinan / mnist_tf.py
Created January 21, 2021 12:39
this code from https://www.tensorflow.org/datasets/keras_example to test my GPU training work
import tensorflow.compat.v2 as tf
import tensorflow_datasets as tfds
tf.enable_v2_behavior()
(ds_train, ds_test), ds_info = tfds.load(
'mnist',
split=['train', 'test'],
shuffle_files=True,
as_supervised=True,
@kittinan
kittinan / selenium.py
Created October 22, 2020 10:33
Python Selenium screenshot capture
# pip install -U selenium
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--window-size=1920,1080")
#chrome_options.add_argument("--disable-gpu")
#chrome_options.add_argument("--no-sandbox") # linux only
@kittinan
kittinan / fake_berthai.ipynb
Created October 14, 2020 16:21 — forked from cstorm125/fake_berthai.ipynb
fake_berthai.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kittinan
kittinan / multiple_process.py
Created October 6, 2020 14:38
Python utilities function to run multiple processes on your function
from tqdm.autonotebook import tqdm
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor, wait, as_completed
import multiprocessing
import time
def run_multiple_process(func, params=[], num_cpu=None, verbose=True):
start_time = time.time()