Skip to content

Instantly share code, notes, and snippets.

View sbwtw's full-sized avatar
🎮
Focusing

石博文 sbwtw

🎮
Focusing
View GitHub Profile
@sbwtw
sbwtw / mc7.md
Created August 24, 2022 02:11 — forked from nnaumenko/mc7.md
Simatic MC7 code

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
@sbwtw
sbwtw / config-git-proxy.txt
Created November 28, 2018 08:26 — forked from bynil/config-git-proxy.txt
Use git over socks5 proxy
Port: 1080
1. Create a file /YOUR PATH/gitproxy.sh with content:
#!/bin/sh
nc -X 5 -x 127.0.0.1:1080 "$@"
2. Edit your ~/.gitconfig
# For git://
@sbwtw
sbwtw / clanglib.c
Created July 23, 2018 15:01 — forked from raphaelmor/clanglib.c
clanglib usage example
#include <iostream>
#include <clang-c/Index.h>
#include <clang-c/Platform.h>
void printDiagnostics(CXTranslationUnit translationUnit);
void printTokenInfo(CXTranslationUnit translationUnit,CXToken currentToken);
void printCursorTokens(CXTranslationUnit translationUnit,CXCursor currentCursor);
CXChildVisitResult cursorVisitor(CXCursor cursor, CXCursor parent, CXClientData client_data);
use std::cmp;
fn lis(datas: &Vec<(isize, isize)>) -> isize {
let datas: Vec<(isize, isize)> = datas.iter().map(|&x| {
if x.0 > x.1 {
(x.1, x.0)
} else {
(x.0, x.1)
}