Skip to content

Instantly share code, notes, and snippets.

View zapkub's full-sized avatar
🦄
Doing FINE !

Rungsikorn Rungsikavarnich zapkub

🦄
Doing FINE !
View GitHub Profile
@zapkub
zapkub / index.js
Created September 3, 2023 14:43
Setup multi port with reverse proxy
import * as Express from 'express';
import { Router } from 'express'
import { createProxyServer } from 'http-proxy';
// ส่วนนี้คือ http server ของ front-ui
const frontendRouter = Router();
frontendRouter.all('/', (req, res) => {
res.redirect('/index.html')
})
@zapkub
zapkub / gist:8d8d78b53d2df451cd95abcd8f81b464
Created September 3, 2023 07:16
how to merge 2 express
import * as Express from 'express';
import { Router } from 'express'
const frontendRouter = Router();
frontendRouter.all('/', (req, res) => {
res.redirect('/index.html')
})
frontendRouter.get('/index.html', (req, res) => {
@zapkub
zapkub / mc-780.bin
Created February 20, 2022 12:55
Tanita MC-780 bluetooth package communication decoding
0D 0A is the message delimiter
SEND
12 12 00 51 0D 0A // Q ? Send Q at the first time after configuration notification is done
12 12 00 4D 31 0D 0A // M1 maybe this is instruction initialize? ( the scaler answer '@')
12 12 00 44 30 30 2E 35 0D 0A // this is 'D00.5' means Data type 0 (clothes weight), value = 0.5 and then machine return 1B 12 00 44 30 0D 0A
12 12 00 44 31 31 0D 0A // this is D11 (gender 1 is male (see GE))
12 12 00 44 32 30 0D 0A // this id D20 (body type 0 is standard)
12 12 00 44 33 31 37 33 2E 30 0D 0A // this is D3173.0 this is height
12 12 00 44 34 33 32 0D 0A // 'D432' this is age
@zapkub
zapkub / bs58-to-uint8.bash
Last active December 30, 2021 09:28
export phantom wallet secret key to solana cli system keypair format
npm install -g bs58
BS58_SECRET=<YOUR_SECRET> NODE_PATH="$(npm config get prefix)/lib/node_modules" node -e "console.log(new Uint8Array(require('bs58').decode(process.env.BS58_SECRET)))"
export const Badthing = (): MethodDecorator => {
return (
target: Object,
key: string | symbol,
descriptor: PropertyDescriptor,
) => {
const originalMethod = descriptor.value;
console.log("Badthing");
@zapkub
zapkub / decouple.ts
Created September 14, 2021 11:59
decoupling everlong things
type Message = Uint8Array;
class BluetoothControl {
collectScanResult() {
}
private _onDiscoverCallback: (device: BLEDevice) => void
class Class1 {
int i = 0;
}
class Class2 extends Class1 {
}
void main() {
class Class1 {
static Class1 instance = new Class1();
int i = 0;
}
class Class2 {
void set i(int val) {
Class1.instance.i = val;
}
function renderDiamond(input) {
let preSpace = (input - 1) / 2
let postSpace = (input - 1) / 2
let output = ""
let f = (input - 1) / 2
for (var line = 0; line < input; line++) {
for (var col = 0; col < input; col++) {
package com.company;
// สร้างโปรแกรมที่สามารถ วาด * ออกมาเป็นรูป เลขาคณิต 3 แบบ
// - สี่เหลี่ยมจตุรัส
// - สามเหลี่ยม
// - ข้าวหลามตัด
// โดยที่มี input เป็น int ที่ 0 < n < 20
class Shape {