Skip to content

Instantly share code, notes, and snippets.

View luojiyin1987's full-sized avatar
💭
I may be slow to respond.

luo jiyin luojiyin1987

💭
I may be slow to respond.
View GitHub Profile
@luojiyin1987
luojiyin1987 / main.go
Created November 27, 2024 03:51 — forked from hylarucoder/main.go
golang serve media dir
package main
import (
"log"
"net/http"
)
func main() {
// Create file server handler
fs := http.FileServer(http.Dir("./media"))
@luojiyin1987
luojiyin1987 / markdown_convert_links.py
Created June 27, 2024 00:22
[descriptions](url) to [descriptions][number]
@luojiyin1987
luojiyin1987 / index.js
Created October 28, 2023 04:14 — forked from abersheeran/llama2-2-7b-chat-int8-worker.js
llama2-2-7b-chat-int8 in Cloudflare workers
import { Ai } from './vendor/@cloudflare/ai.js';
export default {
async fetch(request, env) {
const ai = new Ai(env.AI);
// prompt - simple completion style input
// let simple = {
// prompt: 'Tell me a joke about Cloudflare'
// };
@luojiyin1987
luojiyin1987 / Dockerfile
Created March 18, 2023 14:43 — forked from nginx-gists/Dockerfile
Our Roadmap for QUIC and HTTP3 Support in NGINX
# Builds NGINX from the QUIC+HTTP/3 development branch
# - Based on the official NGINX docker image, including all modules built by default
# - OpenSSL replaced with LibreSSL to support QUIC's TLS requirements (statically linked)
#
# docker build --no-cache -t nginx:quic .
# docker run -d -p 443:443 -p 443:443/udp nginx:quic
#
# Note that a suitable configuration file and TLS certificates are required for testing!
# See <https://quic.nginx.org/readme.html> for more info
@luojiyin1987
luojiyin1987 / trans.py
Created September 5, 2022 14:44 — forked from haixinsong/trans.py
simple file encode trans python tool
from os import listdir
from os import walk
from os.path import isfile,isdir,join
from chardet.universaldetector import UniversalDetector
# may need to `pip3 install chardet`
import codecs
detector = UniversalDetector()
# change the targetPath to your path
@luojiyin1987
luojiyin1987 / gitgraft.sh
Created August 29, 2022 23:50 — forked from Victrid/gitgraft.sh
Find which commit your no-git friend is working on and generate patches for attaching their works onto git tree.
#!/bin/bash
hash git 2>/dev/null || { echo >&2 "Required command 'git' is not installed. ( hmm... why are you using this? ) Aborting."; exit 1; }
hash realpath 2>/dev/null || { echo >&2 "Required command 'realpath' is not installed. Aborting."; exit 1; }
hash pwd 2>/dev/null || { echo >&2 "Required command 'pwd' is not installed. Aborting."; exit 1; }
hash cd 2>/dev/null || { echo >&2 "Required command 'cd' is not installed. Aborting."; exit 1; }
hash echo 2>/dev/null || { echo >&2 "Required command 'echo' is not installed. Aborting."; exit 1; }
hash mv 2>/dev/null || { echo >&2 "Required command 'mv' is not installed. Aborting."; exit 1; }
hash diff 2>/dev/null || { echo >&2 "Required command 'diff' is not installed. Aborting."; exit 1; }
hash diffstat 2>/dev/null || { echo >&2 "Required command 'diffstat' is not installed. Aborting."; exit 1; }

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocal you use. And there're two common protocals: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocal. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p
@luojiyin1987
luojiyin1987 / exercise-tracker.js
Last active December 7, 2021 13:36
fcc 运动追踪器
// server.js
// where your node app starts
// init project
var express = require('express');
const bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
@luojiyin1987
luojiyin1987 / delete_all_imessage_conversations.applescript
Created November 28, 2021 07:05 — forked from lexrus/delete_all_imessage_conversations.applescript
Delete all iMessage conversations. Compatible with macOS Monterey. Please check Reduce motion before launch this apple script.
# System Preferences -> Accessibility -> Display -> Reduce motion
tell application "Messages" to activate
tell application "Messages"
set chatCount to (count of chats)
end tell
tell application "System Events"
tell process "Messages"
@luojiyin1987
luojiyin1987 / match-word.js
Created November 4, 2021 03:37
通过正则回溯 进行词的匹配
function spinalCase(str) {
return str
.split(/\s|_|(?=[A-Z])/)
.toLowerCase();
}