Skip to content

Instantly share code, notes, and snippets.

View v5tech's full-sized avatar
🎯
Focusing

v5tech

🎯
Focusing
  • Xi'an China
  • 08:27 (UTC +08:00)
View GitHub Profile
@laixintao
laixintao / decent_request.py
Last active February 20, 2024 12:05
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))
@adrienbrault
adrienbrault / llama2-mac-gpu.sh
Last active April 22, 2024 08:47
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM. UPDATE: see https://twitter.com/simonw/status/1691495807319674880?s=20
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
make clean
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
@yuhangch
yuhangch / header-editor-config.json
Last active August 31, 2023 03:42
cn.bing redirect to www.bing
{
"request": [
{
"enable": true,
"name": "bing-cn-to-www",
"ruleType": "redirect",
"matchType": "prefix",
"pattern": "https://cn.bing.com",
"exclude": "",
"group": "bing-redirect",
@marcpinet
marcpinet / README.md
Last active May 14, 2024 12:56
Activate Sublime Text 4 Build 4143 and below for ever (also maybe above, but not yet tried)

Activate Sublime Text (for ever)

  1. Go to https://hexed.it/
  2. Click Open File in the top left corner and select sublime_text.exe
  3. Press CTRL + F or on the Search for bar in the left panel and look for: 80 78 05 00 0f 94 C1
  4. Now in the editor, click on the first byte (80) and start replacing each byte by: C6 40 05 01 48 85 C9
  5. Finally, in the top left corner again, click on Save as and replace the old executable file with the newly created one.

Enjoy an Unlimited User License!

@stilleshan
stilleshan / acme_docker.sh
Last active February 10, 2024 10:06
基于 docker 环境 acme.sh 申请 Let's Encrypt 泛域名证书的交互式一键脚本.
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# fonts color
Green="\033[32m"
Red="\033[31m"
Yellow="\033[33m"
GreenBG="\033[42;37m"
RedBG="\033[41;37m"
@coltenkrauter
coltenkrauter / docker-compose.yaml
Last active January 25, 2024 19:46
Traefik V2 Docker Compose file with LetsEncrypt and HTTPS redirect - Traefik dashboard and simple whoami service
# Tutorial: https://blog.creekorful.com/2020/01/how-to-expose-traefik-2-dashboard-securely-docker-swarm/
version: '3'
services:
reverse-proxy:
image: traefik:2.3
command:
# - '--log.level=DEBUG'
- '--api=true'
- '--api.dashboard=true'
#!/bin/bash
# data: 2020-03-31
# author: muzi502
# for: Fuck GFW and download some raw file form github without proxy using jsDelivr CDN
# usage: save the .she to your local such as /usr/bin/rawg, and chmod +x /usr/bin/rawg
# use rawg https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh to download
set -xue
# GitHub rul: https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh
# jsDelivr url: https://cdn.jsdelivr.net/gh/ohmyzsh/ohmyzsh/tools/install.sh
@fworks
fworks / install-zsh-windows-git-bash.md
Last active May 21, 2024 05:32
Zsh / Oh-my-zsh on Windows Git Bash
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 21, 2024 12:50
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@luzihang123
luzihang123 / sensitive_pic.py
Created November 2, 2018 09:23
爬虫敏感图片的识别与过滤
from functools import reduce
from PIL import Image
import requests
# 计算pHash(只需要三行):
def phash(img):
img = img.resize((8, 8), Image.ANTIALIAS).convert('L')
avg = reduce(lambda x, y: x + y, img.getdata()) / 64.
return reduce(
lambda x, y: x | (y[1] << y[0]),