Skip to content

Instantly share code, notes, and snippets.

@tklee1975
tklee1975 / simpleImageClassifier
Created May 11, 2023 06:34
Simple Testing Image Classification
imagePath = "test.jpg"
# Replace this with the path to your image
image = Image.open(imagePath).convert("RGB")
# resizing the image to be at least 224x224 and then cropping from the center
size = (224, 224)
# image = ImageOps.fit(image, size, resample=Image.BICUBIC)
image = image.resize(size, resample=Image.BICUBIC)
@tklee1975
tklee1975 / photo_classifier.py
Created May 8, 2023 07:48
Python Photo Classifier (Starter Version)
from keras.models import load_model # TensorFlow is required for Keras to work
from PIL import Image, ImageOps # Install pillow instead of PIL
import numpy as np
import os
import shutil
# ----------------------------
# Setup Model
# ----------------------------
# Disable scientific notation for clarity
@tklee1975
tklee1975 / custom.ini
Created September 25, 2022 16:59
Improved Wordpress Docker Compose files
file_uploads = On
memory_limit = 256M
upload_max_filesize = 1024M
post_max_size = 1024M
max_execution_time = 300
max_input_time = 1000
@tklee1975
tklee1975 / App.js
Created March 29, 2022 15:39
Jimp React Demo
// Install Jimp
// npm install jimp --save
// Offical site
// https://www.npmjs.com/package/jimp
// Sample Reference
// https://img.ly/blog/how-to-manipulate-an-image-with-jimp-in-react/
import './App.css';
import Jimp from "jimp";
import { useEffect, useState } from "react";
@tklee1975
tklee1975 / Dockerfile-v1
Created March 23, 2022 15:46
A very very simple Dockerfile
# version 1
# Base on alpine OS
FROM alpine:latest
#
WORKDIR /user/local/bin
# Make simple hello script
RUN echo "echo \"Hello Alpine\"" > ./hello.sh
RUN chmod u+x *.sh
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tailwind Demo</title>
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
</head>
@tklee1975
tklee1975 / no-this.js
Created July 11, 2021 17:08
JS: This vs No-this
function foo() {
var a = 2;
function bar() {
console.log(a);
}
bar();
}
foo()
@tklee1975
tklee1975 / cppObjectLife.cpp
Last active March 30, 2021 02:12
Study C++ Object life cycle
#include <stdio.h>
#include <iostream>
#include <memory>
#include <vector>
struct Tracer { // ken: from book 'C++ Crash course' Page 97
private:
const char* const _name; // const xxx const mean cannot alter both address and content
public:
Tracer(const char *name)
@tklee1975
tklee1975 / responsive_badge.html
Last active February 16, 2021 13:37
A Bootstrap Badge showing the using device
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Badge</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
@tklee1975
tklee1975 / main.dart
Created September 19, 2020 08:40
A very simple flutter widget!
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override