Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WARNING: NOT QUITE WORKING... | |
import sys | |
import subprocess | |
import bisect | |
from pathlib import Path | |
def run_command(command_list): | |
success = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PyItertoolPermutation { | |
public static void main(String[] args) { | |
char[] arr = {'A', 'B', 'C', 'D'}; | |
int r = 2; | |
dfs(0, arr, r); | |
} | |
public static void dfs(int changing_idx, char[] arr, int r) { | |
if (changing_idx == r){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
原帖:https://bgm.tv/group/topic/375970 | |
TLDR:本 gist 试图找出深圳地铁图上的最长环 | |
新算法运行说明 | |
1. 把 `metroStationsList.js` 里的站点信息单独存储成一个 `all_lines.json` | |
2. 运行 `prepare_graph.py` | |
3. 运行 `find_graphillion.py` | |
4. 运行 `decode_result.py` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## method | |
disable line no / file name logging: comment out line 10~13 in `index.js` | |
benchmark use `gocannon`: ./gocannon http://localhost:3000 -d 10s -c 50 | |
## summary | |
without: 3495 req/s | |
with: 3204 req/s | |
perf cost: ~8.3% | |
## without line no / file name logging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ts = require("typescript"); | |
const {readFileSync} = require("fs"); | |
const filename = "source.ts"; | |
// tsconfig | |
const options = {"target": "ESNext", | |
"module": "ESNext", | |
"moduleResolution": "node"} | |
const compilerHost = { | |
...ts.createCompilerHost(options), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Parse Protobuf File in Frontend Example</title> | |
</head> | |
<body> | |
<textarea id="protobuf-content" rows="10" cols="80"></textarea> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# built with chatgpt | |
import pyautogui | |
import cv2 # opencv-python | |
import numpy as np | |
import time | |
from datetime import datetime, timedelta | |
# also need: pillow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Base64 Encoder</title> | |
</head> | |
<body> | |
<textarea id="myTextArea" rows="10" cols="50"></textarea> | |
<br> | |
<button onclick="encodeText()">Encode to Base64</button> | |
<br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import sseclient | |
# API_KEY = 'sk-xxx' | |
def performRequestWithStreaming(): | |
reqUrl = 'https://api.openai.com/v1/chat/completions' | |
reqHeaders = { |