Skip to content

Instantly share code, notes, and snippets.

View zh4n7wm's full-sized avatar
🎯
Focusing

Hydra zh4n7wm

🎯
Focusing
View GitHub Profile
@zh4n7wm
zh4n7wm / decent_request.py
Created December 21, 2023 05:27 — forked from laixintao/decent_request.py
Send HTTP requests using python-requests with timeout, tcp reuse(session) and retry.
from requests.adapters import HTTPAdapter, Retry
from requests import Session
retries = Retry(
total=5, backoff_factor=1, status_forcelist=[502, 503, 504]
)
session = Session() # reuse tcp connection
session.mount("http://", HTTPAdapter(max_retries=retries))
session.mount("https://", HTTPAdapter(max_retries=retries))
@zh4n7wm
zh4n7wm / gpu-tips.md
Last active May 25, 2024 01:17
gpu tips
@zh4n7wm
zh4n7wm / ping.go
Last active June 26, 2023 12:04
pinecone ping demo
package main
import (
"bytes"
"context"
"crypto/ed25519"
"encoding/hex"
"encoding/json"
"flag"
"fmt"
@zh4n7wm
zh4n7wm / GitConfigHttpProxy.md
Created December 22, 2022 02:21 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

package main
import (
"fmt"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
@zh4n7wm
zh4n7wm / tls-ca.go
Created April 23, 2022 09:41 — forked from ashee/tls-ca.go
golang tls with self-signed cert
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
)
@zh4n7wm
zh4n7wm / mysql-tips.md
Created January 11, 2022 05:47
mysql tips

MySQL tips

reset password

跳过权限检查,让 root 没有密码就能进入 MySQL

sudo systemctl edit mysql
@zh4n7wm
zh4n7wm / vim-tips.md
Last active June 6, 2021 03:01
Vim Tips

neovim

install

brew install neovim

config

@zh4n7wm
zh4n7wm / podman-tips.md
Created March 4, 2021 09:29
podman tips
@zh4n7wm
zh4n7wm / verify-aws-ec2-key-pair-fingerprint.md
Created December 30, 2020 13:57 — forked from iamkominn/verify-aws-ec2-key-pair-fingerprint.md
Verifying AWS EC2 Key Pair's Fingerprint

If you created your key pair using AWS, you can use the OpenSSL tools to generate a fingerprint as follows:

$ openssl pkcs8 -in path_to_private_key -inform PEM -outform DER -topk8 -nocrypt | openssl sha1 -c

If you created a key pair using a third-party tool and uploaded the public key to AWS, you can use the OpenSSL tools to generate the fingerprint as follows:

$ openssl rsa -in path_to_private_key -pubout -outform DER | openssl md5 -c