Skip to content

Instantly share code, notes, and snippets.

View shijiezhou1's full-sized avatar

Shijie Zhou shijiezhou1

View GitHub Profile
model
from sqlalchemy.dialects.postgresql import JSON
class JSONModel(Model):
__bind_key__ = 'APP_DB'
__tablename__ = 'json_model'
id = Column(Integer, primary_key=True)
@shijiezhou1
shijiezhou1 / client.py
Created May 27, 2024 13:53
Client site command sender
import socket
HOST = '127.0.0.1'
PORT = 65432
def send_command(conn, command):
conn.sendall(command.encode())
while True:
data = conn.recv(1024)
if not data:
@shijiezhou1
shijiezhou1 / server.py
Created May 27, 2024 13:52
listen on command server
import socket
import subprocess
HOST = '127.0.0.1'
PORT = 65432
def handle_client(conn):
try:
while True:
# 接收数据
@shijiezhou1
shijiezhou1 / img_gist
Created December 15, 2022 03:53
img_gist
img_gist
@shijiezhou1
shijiezhou1 / script.sh
Created March 15, 2022 08:13
Moving all file with same extension in mac terminal
find ~/Desktop/xxx/ -name "*.ext" -exec mv -i {} -t ~/Desktop/xxx \;
@shijiezhou1
shijiezhou1 / re-assign.js
Created March 8, 2022 06:18
Reassign const value
Reassign const
const { type, title, description } = MAP[status];
({ type, description } = MAP[status]);
@shijiezhou1
shijiezhou1 / calculator.js
Last active November 7, 2021 06:25
calculator.js
var calculate = function (s) {
const stackData = lexer(s);
// console.log({stackData});
return run(stackData);
};
function run(stack) {
let pos = 0;
@shijiezhou1
shijiezhou1 / flatten-array-function.md
Last active August 19, 2021 08:33
Flatten Array Manually
let arr0 = [1, 3, 4, 5, [1]];
let arr1 = [1, 2, 3, [1, [2, { a: 3 }], 4, [2, 3, 4]]];

function flatten(input) {
    const stack = [...input];

    const res = [];
    let i = 0;
 while (stack.length) {
@shijiezhou1
shijiezhou1 / javascript
Last active August 16, 2021 15:35
runSequentially function
// the function is to make sure the answer is correctly return
async function runSequentially(functions) {
const resolveLists = []
for (const fu of functions) {
resolveLists.push(await fu());
};
return resolveLists;
}
@shijiezhou1
shijiezhou1 / Todo.vue
Created October 6, 2020 21:53
Vue3 Todo
<template>
<ul>
<li
v-for="(todolist, index) in TodoLists"
:key="index"
>
<span class="name">{{todolist.name}}</span>
<span
class="delete"
@click="Delete(todolist.id)"