Skip to content

Instantly share code, notes, and snippets.

View chaidhat's full-sized avatar
🇹🇭
Thai

Chaidhat Chaimongkol chaidhat

🇹🇭
Thai
View GitHub Profile
@chaidhat
chaidhat / machine-learning-linear-regression.py
Created January 11, 2021 14:14
My first ever machine learning with 100% code by me. No ML helper libraries used.
import math # this library helps with mathematics
import matplotlib.pyplot as plt # this library helps visual plotting
# our data points in a 2D matrix
data = [
[0.5, 1.4],
[2.3, 1.9],
[2.9, 3.2],
]
@chaidhat
chaidhat / simultaneous-approximator.py
Last active October 4, 2020 13:26
Approximates simultaneous equations by brute force. Works with multiple solutions.
# Chaidhat Chaimongkol
# 02-10-20 for 5 hours
# I have developed a brute-forcer for simultaneous equations with two variables and can work with equations with more than one solution. Below is an example of how to use it.
import parser
import math
import copy
from math import sin
@chaidhat
chaidhat / quine-virus.c
Last active November 5, 2020 13:35
Cheating quine, but self compiles itself.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
// this is all done by me, Chaidhat Chaimongkol
// reminiscent of mitosis
int SAFETY_OFFSET = 11; // filename is 11 characters long
int SAFETY_LIMIT = 3; // limit to a depth of
@chaidhat
chaidhat / Kick Start round C
Last active August 23, 2020 12:15
Kick Start round C 17/05/2020
17-MAY-2020
Chaidhat Chaimongkol
Stuti Shah
45th percentile
6270/13650
@chaidhat
chaidhat / blender.py
Last active October 22, 2020 13:30
3D Cellular Automata (Python+C+Blender) https://github.com/Chai112/Cellular-Automata
# Check out the results at the bottom of the page! <SCROLL DOWN>
import bpy
from random import randint
# https://docs.blender.org/api/current/info_quickstart.html
# https://blender.stackexchange.com/questions/79665/can-i-use-objects-custom-properties-inside-cycles-materials/93621#93621
time_frame = 0
time_scale = 2
iteration_max = 10
@chaidhat
chaidhat / craytracer.c
Last active October 3, 2020 10:30
Does CPU-based raytracing
// C Raytracer by Chaidhat Chaimongkol
// 20/12/2019
// Does very simple CPU-based raytracing and outputs it as ASCII art
//
// Inspired by Sebastian Lague
// https://www.youtube.com/watch?v=9RHGLZLUuwc&list=LL2T54R7-vJmcMBzcaTL_oBw&index=1707
// References:
// http://blog.three-eyed-games.com/2018/05/03/gpu-ray-tracing-in-unity-part-1/
// http://mewbies.com/geek_fun_files/ascii/ascii_art_light_scale_and_gray_scale_chart.htm
// https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection
@chaidhat
chaidhat / Himawari8SatDesktop.java
Last active June 6, 2024 22:54
Downloads Meterological Images (visible band) from Himawari 8 Geo-stationary Satellite, colour corrects it and sets desktop with realtime images
/*
* Himawari 8 Satellite
* Chaidhat Chaimongkol 2 May 2019
* Downloads Meterological Images (visible band) from http://www.jma.go.jp/jma/en/menu.html and sets desktop with realtime, colour corrected, geo-stationary images
* The Japan Meterological Agency's Himawari Geostationary Satellite
*
* Sets desktop wallpaper to realtime image of Himawari every 10 minutes, which are recent from 5-15 minutes
* For ONLY Mac Mojave ++, uses Java and Applescript and exported as .jar file.
* Created for no reason at all, all code is Chai's
*