Skip to content

Instantly share code, notes, and snippets.

View gitsrc's full-sized avatar
🦄
welcome

GITSRC gitsrc

🦄
welcome
View GitHub Profile

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocol you use. And there're two common protocols: 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 protocol. 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
@gitsrc
gitsrc / index.html
Created September 3, 2021 15:13 — forked from tmichel/index.html
simple websocket example with golang
<html>
<head>
<title>WebSocket demo</title>
</head>
<body>
<div>
<form>
<label for="numberfield">Number</label>
<input type="text" id="numberfield" placeholder="12"/><br />
@gitsrc
gitsrc / ipcalc.go
Created September 2, 2021 06:45 — forked from kotakanbe/ipcalc.go
get all IP address from CIDR in golang
package main
import (
"net"
"os/exec"
"github.com/k0kubun/pp"
)
func Hosts(cidr string) ([]string, error) {
@gitsrc
gitsrc / build-git.md
Created January 29, 2021 09:15 — forked from egorsmkv/build-git.md
Build git from source code on CentOS 7

Build git from source code

1) Go to https://git-scm.com/ and check out the latest version of Git

Currently, the latest version is 2.18.0. Download and extract it and go to the folder of the source code:

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
tar xf git-2.18.0.tar.gz
cd git-2.18.0/
@gitsrc
gitsrc / unixhttpc.go
Created July 11, 2020 13:36 — forked from teknoraver/unixhttpc.go
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"
{
"workbench.colorTheme": "Default Light+",
"git.ignoreLegacyWarning": true,
"window.zoomLevel": 0,
"terminal.integrated.fontFamily": "monospace",
"go.formatTool": "goimports",
"go.useLanguageServer": true,
"editor.formatOnSave": true,
"files.autoSave": "afterDelay",
"workbench.iconTheme": "vscode-icons-mac",
@gitsrc
gitsrc / golang-tls.md
Created January 2, 2020 10:00 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@gitsrc
gitsrc / install-firacode.sh
Created November 26, 2019 02:11 — forked from nikhita/install-firacode.sh
How to install FiraCode font on Linux
mkdir -p ~/.local/share/fonts
for type in Bold Light Medium Regular Retina; do wget -O ~/.local/share/fonts/FiraCode-$type.ttf "https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-$type.ttf?raw=true"; done
fc-cache -f
@gitsrc
gitsrc / libuv_tcp_redis_server_example.c
Last active October 22, 2019 10:04
libuv_tcp_redis_server_example.c
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "hiredis/hiredis.h"
#include <string.h>
#include "uv.h"
typedef struct {
uv_write_t req;
@gitsrc
gitsrc / send_udp.c
Created June 13, 2019 05:53
linux c send udp
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include "../common/common.h"
int sendUdpPackage(char *udpPackage, Config_INI *config) {
struct sockaddr_in servaddr;