Skip to content

Instantly share code, notes, and snippets.

Avatar

Nattawut Phetmak neizod

View GitHub Profile
@neizod
neizod / antumbra.ipynb
Created Mar 2, 2020
Umbra-Penambra-Antumbra and Shadow Densities.
View antumbra.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@neizod
neizod / bkk_aqi_data.csv
Last active Oct 11, 2019
Interpolate Bangkok Pollution with IDW (and Voronoi)
View bkk_aqi_data.csv
x y aqi note
390 60 82 Bang Plat
520 150 78 Phaya Thai
750 160 99 Wang Thonglang
530 260 74 Pathum Wan
410 460 151 Rat Burana
520 480 76 Phra Pradaeng
730 460 65 Bang Na
1060 140 255 ?
View mersenne-twister.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View 0-1-check_int.cpp
#include <iostream>
using namespace std;
bool is_int(string number) {
bool after_dot = false;
for (char c : number) {
if (after_dot and c != '0') {
return false;
} else if (c == '.') {
@neizod
neizod / answer-final.mzn
Last active Nov 26, 2018
MiniZinc examples for Blognone.
View answer-final.mzn
array[1..3] of int: divisors = [2, 3, 7];
var 1..100: answer;
constraint forall(d in divisors)( answer mod d == 0 );
solve satisfy;
output [ "The ultimate answer is \(answer).\n" ];
View smallest-circle.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View informal-template.cls
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{independent-study}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions\relax
\LoadClass[11pt,a4paper,oneside]{book}
% thai book
\usepackage[english,thai]{babel}
@neizod
neizod / ulti-chull.ipynb
Created Aug 7, 2018
Kirkpatrick–Seidel algorithm
View ulti-chull.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@neizod
neizod / draw-cubic-ufo.R
Last active May 25, 2018
3D drawing script for explaining how to solve Google Code Jam, 2018 Qualification, Cubic UFO.
View draw-cubic-ufo.R
#!/usr/bin/env Rscript
library(rgl)
library(sp)
calc_radian <- function(i, tick, uplim) {
2 * pi * (i / tick) * (uplim / 360)
}
@neizod
neizod / coupon.R
Last active Jul 16, 2017
R Program That Draw Histogram of Coupon's Collector Problem
View coupon.R
random.int <- function(n) { sample.int(n, 1) }
random.coupon <- function(...) {
count <- 0
have.coupon <- logical(...)
while (!all(have.coupon)) {
have.coupon[random.int(...)] <- TRUE
count <- count + 1
}
You can’t perform that action at this time.