Skip to content

Instantly share code, notes, and snippets.

View mrchoke's full-sized avatar
🤘

MrChoke mrchoke

🤘
View GitHub Profile
@mrchoke
mrchoke / README.md
Last active May 5, 2024 08:52
cURL brew formula support HTTP/3

How to

Remove old curl

brew uninstall --ignore-dependencies curl

Download the curl ruby install script

@mrchoke
mrchoke / image2dockerfile.sh
Last active April 15, 2022 06:38
# การแสดงประวัติการสร้าง Docker image ด้วยคำสั่ง docker history
#!/bin/bash
# MrChoke
# Ref: https://docs.docker.com/engine/reference/commandline/history/
# Ref: https://stackoverflow.com/questions/19104847/how-to-generate-a-dockerfile-from-an-image
if [ $# -eq 0 ]; then
echo "No docker image provided."
echo -e "Example:\n"
echo -e "$0 nginx:latest\n"
exit 1
@mrchoke
mrchoke / README.md
Created September 23, 2021 04:59
openconnect on macOS

การใช้ openconnect แทนการใช้ AnyConnect บน macOS

Install

brew install openconnect

Password

@mrchoke
mrchoke / prayut.click.js
Last active August 17, 2021 00:07
https://prayut.click n = pop , g = Guild , t = current timestamp #bot
setInterval(() => {
window.fetch('https://api.prayut.click/clicks', {
method: 'POST',
body: JSON.stringify({
n: Math.floor(Math.random() * 10) + 990,
g: 4,
t: Date.now()
}),
headers: {
'Content-type': 'application/json; charset=UTF-8'
@mrchoke
mrchoke / date_between.sh
Created August 1, 2021 13:14
Loop between two date bash macOS and Linux
#!/bin/bash
d=2020-12-01
t=2021-01-01
while [ "$d" != "$t" ]; do
echo $d
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
printf '=%.0s' {1..25}
@mrchoke
mrchoke / JSLocaleSort.html
Last active March 9, 2020 15:27
ตัวอย่างการ Sort โดยใช้ Locale Compare ใน JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS Sort Example</title>
</head>
<body>
<h1>Locale Sort Example</h1>
<hr/>
@mrchoke
mrchoke / ThreadPoolExecutor.py
Last active February 29, 2020 14:31
ตัวอย่างการแตก Thread มารับงานทำเสร็จก็เสร็จกันไปไม่ต้องรอ ง่ายกว่าใช้ Threading แบบปกติ
import concurrent.futures
from datetime import datetime
import time
import random
def process(i, data):
t = random.randrange(5)
time.sleep(t)
print("Process index:", i, ' Sleep:', t, ' Current:', datetime.now())
@mrchoke
mrchoke / threading_exit_02.py
Created February 29, 2020 11:02
ปิด thread เมื่อข้อมูลโดนประมวลผลเสร็จแล้ว ตัวอย่างนี้จะเป็นตัวอย่างที่ปิด เมื่อทำงานเสร็จ
import threading
import queue
import time
import signal
import sys
from datetime import datetime
class myThreading():
def __init__(self, n=3):
@mrchoke
mrchoke / threading_exit_01.py
Last active February 29, 2020 11:01
ปิด thread เมื่อข้อมูลโดนประมวลผลเสร็จแล้ว ตัวอย่างนี้จะเป็นตัวอย่างที่ไม่ปิด เมื่อทำงานเสร็จ
import threading
import queue
import time
import signal
import sys
from datetime import datetime
class myThreading():
def __init__(self, n=3):
module.exports = {
productionSourceMap: false,
devServer: {
compress: true,
proxy: {
'^/api': {
target: 'http://api/',
pathRewrite: { '^/api': '' },
changeOrigin: true
}