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 / 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
*
const ArgumentType = require('../../extension-support/argument-type');
const BlockType = require('../../extension-support/block-type');
const Cast = require('../../util/cast');
const log = require('../../util/log');
const nets = require('nets');
const languageNames = require('scratch-translate-extension-languages');
const formatMessage = require('format-message');
/**
* Icon svg to be displayed in the blocks category menu, encoded as a data URI.
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <conio.h> /* getch() and kbhit() */
using namespace std;
@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 / wordcounter.c
Created January 18, 2020 10:28
Counts all words excluding double spaces
#include <stdio.h>
#include <string.h>
// dir /b /a-d
int main() {
FILE *fp;
const char *filetree = "filetree.txt";
@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 / Kick Start round A
Last active October 18, 2020 15:16
Kick Start round A 22/03/2020
22-MAR-2020
Chaidhat Chaimongkol
Patrick Ledoit
20th percentile
10921/13700
@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 / quine.c
Created July 19, 2020 09:21
self replicating code, inspired by https://cs.lmu.edu/~ray/notes/quineprograms/
#include <stdio.h>
int main () {
char *dat = "#include <stdio.h>%cint main () {%c%cchar *dat=%c%s%c;%c%cprintf(dat,10,10,9,34,dat,34,10,9,10);%c}";
printf(dat,10,10,9,34,dat,34,10,9,10);
}
@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