Skip to content

Instantly share code, notes, and snippets.

View piti118's full-sized avatar

Piti Ongmongkolkul piti118

  • Mahidol University International College
  • Nakorn Pathom, Thailand
View GitHub Profile
openapi: '3.0.2'
info:
title: API Title
version: '1.0'
servers:
- url: https://api.server.test/v1
paths:
/what-time-is-it:
get:
responses:
@piti118
piti118 / tkinter_spring.py
Created April 4, 2022 13:37
tkinter resizable layout via grid weight
import tkinter as tk
def asf(frame, prefix):
lb = tk.Listbox(frame)
for i in range(10):
lb.insert(i, f'{prefix} {i}')
return lb
{
"username": "frappet",
"doctor": {
"name": "Kazuya Sojo",
"license": "12345678"
},
"patient": {
"name": "Green Covid",
"cid": "1234567890123",
"phoneno": "0811234567",
@piti118
piti118 / default_config.yaml
Created March 5, 2019 18:40
decent default mqtt configuration
listeners:
default:
type: tcp
bind: 0.0.0.0:1883
my-ws-1:
bind: 0.0.0.0:8080
type: ws
sys_interval: 20
auth:
allow-anonymous: true
import numpy as np
def random_mask(a, n_choose):
ret = a.copy()
indices = np.random.choice(np.nonzero(a)[0], n_choose, replace=False)
ret[:] = 0
ret[indices] = a[indices]
return ret
def random_flip(a, n_flip):
export function memoize(fn) {
var cache = null
var lastRet = null
function cacheHit(oldCache, newCache) {
return oldCache.length == newCache.length &&
oldCache.every((x,i) => x === newCache[i])
}
return (...args) => {
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
pipeline:
restore-cache:
image: drillster/drone-volume-cache
restore: true
mount:
- /drone/.m2
volumes:
- /tmp/cache:/cache
build:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.