Skip to content

Instantly share code, notes, and snippets.

View kitisak's full-sized avatar

Kitisak Thossaensin kitisak

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nlw0
nlw0 / change.cpp
Last active December 5, 2019 16:16
change-making problem in multiple languages
#include <unordered_set>
#include <vector>
#include <optional>
#include <iostream>
#include <chrono>
#include <ctime>
template<typename T> std::optional<int> minimum_coins(T target, std::vector<T> denominations) {
auto values = new std::unordered_set<T>(); values->insert(target);
auto k = 0;
@korakot
korakot / pycon_th_2019.md
Last active August 10, 2019 11:28
PyCon Thailand 2019 slides and demo notebooks
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>DApp Tutorial</title>
<style>
body {
@korakot
korakot / embed.py
Last active January 30, 2020 06:18
Download Kaggle data into Google Colab
!mkdir ~/.kaggle
!echo '{"username":"korakot","key":"8db2e62c9fcbb3d2cc204a01671189num+2"}' > ~/.kaggle/kaggle.json
!chmod 600 ~/.kaggle/kaggle.json
# list files
!kaggle datasets files robervalt/sunspots
# load one file
!kaggle datasets download robervalt/sunspots -f Sunspots.csv
# load all files as a zip
!kaggle datasets download robervalt/sunspots
@coccoinomane
coccoinomane / dialog.html
Last active July 1, 2020 03:42 — forked from arthurattwell/dialog.html
Google Sheets script to allow multi-select in cells with data-validation (adapted from https://gist.github.com/arthurattwell/aa5afc178624bdd6f46c2d0d28d06136, original credits to Alexander Ivanov https://www.youtube.com/watch?v=dm4z9l26O0I)
<div style="font-family: sans-serif;">
<? var data = valid(); ?>
<form id="form" name="form">
<? if(Object.prototype.toString.call(data) === '[object Array]') { ?>
<? for (var i = 0; i < data.length; i++) { ?>
<? for (var j = 0; j < data[i].length; j++) { ?>
<input type="checkbox" id="ch<?= '' + i + j ?>" name="ch<?= '' + i + j ?>" value="<?= data[i][j] ?>"><?= data[i][j] ?><br>
<? } ?>
<? } ?>
<? } else { ?>

Check Version

kubectl version

Get Docs Help

kubectl <cmd> --help
// implement search function that can be filter by name,priceRange or category
fun List<Product>.search(name: String? = null,
priceRange: Pair<Double, Double>? = null,
categoryId: String? = null): List<Product> = TODO("Make it happen")
class ProductDetailFragment : MFragment() {
companion object {
const val ARG_PRODUCT_ID = "PRODUCT_ID"
const val ARG_SOMETHING = " SOMETHING"
fun badInstance(productId: String, something: String?): ProductDetailFragment {
val bundle = MBundle()
bundle.putString(ARG_PRODUCT_ID, productId)
if (something != null) bundle.putString(ARG_SOMETHING, something)
@korakot
korakot / LK82.py
Last active April 13, 2020 04:16
Thai Soundex LK82, Udom83
# ตาม guru.sanook.com/1520
import re
t1 = str.maketrans("กขฃคฅฆงจฉชฌซศษสญยฎดฏตณนฐฑฒถทธบปผพภฝฟมรลฬฤฦวหฮอ",
"กกกกกกงจชชชซซซซยยดดตตนนททททททบปพพพฟฟมรรรรรวหหอ")
t2 = str.maketrans(
"กขฃคฅฆงจฉชซฌฎฏฐฑฒดตถทธศษสญณนรลฬฤฦบปพฟภผฝมำยวไใหฮาๅึืเแโุูอ",
"1111112333333333333333333444444445555555667777889AAABCDEEF")
def LK82(s):
res = []