Skip to content

Instantly share code, notes, and snippets.

View joeke80215's full-sized avatar
:octocat:

joeekee joeke80215

:octocat:
  • Taipei City, Taiwan
View GitHub Profile
@joeke80215
joeke80215 / PerplexityProxyServer.go
Last active February 5, 2024 06:46
Using a reverse proxy for the ChatGPT API to interface with Perplexity.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
)
@joeke80215
joeke80215 / split_swagger.py
Created January 30, 2024 14:55
This Python script is designed to split a large Swagger YAML file into smaller OpenAPI 3.0.0 files based on tags.
import yaml
import os
import argparse
def split_yaml_file_by_tag(file_path, output_dir, server_url):
with open(file_path, 'r', encoding='utf-8') as file:
data = yaml.safe_load(file)
openapi_version = '3.0.0' # OpenAPI version
@joeke80215
joeke80215 / CMakeLists.txt
Created November 12, 2019 14:41
macOS cmake with mysql client
cmake_minimum_required(VERSION 3.15)
project(msyql_exec_client C)
set(CMAKE_C_STANDARD 99)
add_executable(msyql_exec_client main.c /usr/local/Cellar/mysql-connector-c/6.1.11/bin)
include_directories(/usr/local/Cellar/mysql-connector-c/6.1.11/include)
find_library(MYSQL_CLIENT mysqlclient /usr/local/Cellar/mysql-connector-c/6.1.11/lib)
target_link_libraries(msyql_exec_client LINK_PUBLIC ${MYSQL_CLIENT})
@joeke80215
joeke80215 / test_http.go
Created November 11, 2019 08:13
golang gin httptest example
package service
import (
"fmt"
"log"
"net/http"
"net/http/httptest"
"strings"
"testing"
@joeke80215
joeke80215 / gen_rand_string.go
Created August 9, 2019 01:20
generate random string with golang
package auth
import (
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"encoding/hex"
"log"
)
@joeke80215
joeke80215 / .settings.json
Last active October 12, 2022 00:38
vscode vue config
{
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.validation.template": true,
"eslint.validate": [
{
"language": "vue",
"autoFix": true
},
{
"language": "html",
@joeke80215
joeke80215 / main.go
Last active October 12, 2022 00:38
golang fanout example
package main
import (
"fmt"
)
func testP(in <-chan string) {
for v := range in {
fmt.Println(v)
}
@joeke80215
joeke80215 / main.go
Created April 21, 2019 09:04
Golang 最常連續數組
package main
import "fmt"
// longestSlice Longest Consecutive Sequence
func longestConsSeq(sorted []int) ([]int, int) {
max := 1
head := 0
for i := 0; i < len(sorted); i++ {
cur := 1
@joeke80215
joeke80215 / main.go
Created April 20, 2019 13:01
golang max duplicate element
package main
import "fmt"
// MaxDup input a random slice and return max duplicate element and lenght
func MaxDup(a []int) (int, int) {
maxV := 0
max := 0
b := make(map[int]int)
@joeke80215
joeke80215 / atomicTest.go
Last active February 25, 2019 05:08
Golang http atomic vs mutex
package main
import (
"log"
"net/http"
"sync/atomic"
)
type redirector struct {
counter uint32