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
@coin8086
coin8086 / using-proxy-for-git-or-github.md
Last active September 21, 2025 16:28
Use Proxy for Git/GitHub

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
@benrobertsonio
benrobertsonio / lazy-video-loader.js
Last active November 4, 2019 22:02
Lazy Loading Video Based on Connection Speed
class LazyVideoLoader {
constructor() {
this.videos = [].slice.call(document.querySelectorAll('.hero__bgvideo'));
// Abort when:
// - The browser does not support Promises.
// - There no videos.
// - If the user prefers reduced motion.
// - Device is mobile.
if (
@justjavac
justjavac / gc-track.js
Last active June 29, 2022 11:43
JS中怎样判断某个对象是否被GC回收? https://www.zhihu.com/question/345974014/answer/826236205
// 需要通过 node --allow-natives-syntax 参数运行
const { GCSignal, consumeSignals, trackGarbageCollection } = require("gc-signals");
function fn() {
// 创建两个局部变量
const a1 = new GCSignal(1);
const a2 = new GCSignal(2);
global.tmp = a2; // 将 a2 变量赋值给全局变量
const o = {};
trackGarbageCollection(o, 3); // 跟踪局部变量 o 的 GC 状态,标识为 3
@alexjj
alexjj / docker-compose.yml
Created November 29, 2019 19:55
Sample docker-compose with Traefik v2.0 and Lets Encrypt
version: "3.7"
services:
bitwarden:
image: bitwardenrs/server:latest
container_name: bitwarden
volumes:
- /home/alex/docker/bitwarden:/data
restart: unless-stopped
environment:
#!/bin/bash
# for: bulk merge bilibili UWP download file *.flv
# by: blog.502.li
# date: 2019-01-12
# 将该脚放到 UWP 客户端下载缓存主目录下执行,安装 ffmpeg、jq
set -xu
download_dir=$(pwd)
mp4_dir=${download_dir}/mp4
mkdir -p ${mp4_dir}
source: http://182.43.249.225:19735/sdsj.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- saved from url=(0014)about:internet -->
<head>
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
@Tumar
Tumar / gist:cd1ef5ecd88086d49d04d9a4205f4763
Last active April 1, 2025 15:20
Install alertmanager
# Create user
useradd --no-create-home --shell /bin/false alertmanager
# Download and unpack
wget https://github.com/prometheus/alertmanager/releases/download/v0.20.0/alertmanager-0.20.0.linux-amd64.tar.gz
tar -xvf alertmanager-0.20.0.linux-amd64.tar.gz
mv alertmanager-0.20.0.linux-amd64/alertmanager /usr/local/bin/
mv alertmanager-0.20.0.linux-amd64/amtool /usr/local/bin/
chown alertmanager:alertmanager /usr/local/bin/alertmanager
@RossAllenBell
RossAllenBell / saved-objects.ndjson
Last active January 21, 2021 06:15
An ndjson file containing saved objects for importing into Kibana. These saved objects represent an Elastic Workplace Search analytics dashboard and supporting objects.
{"attributes":{"description":"","expression":"kibana\n| kibana_context \n query=\"{\\\"language\\\":\\\"kuery\\\",\\\"query\\\":\\\"event.action : \\\\\\\"SearchMetrics.query\\\\\\\" \\\"}\" filters=\"[]\"\n| lens_merge_tables layerIds=\"c3174128-b2c6-4d1e-ae9d-2916a43a79c9\" \n tables={esaggs index=\"5c306300-eef3-11ea-891f-dbd815c23d04-ews-blog-2020\" metricsAtAllLevels=true partialRows=true includeFormatHints=true timeFields=\"@timestamp\" aggConfigs=\"[{\\\"id\\\":\\\"b171f1a0-ea9d-4937-9ab9-457ff4a8b593\\\",\\\"enabled\\\":true,\\\"type\\\":\\\"date_histogram\\\",\\\"schema\\\":\\\"segment\\\",\\\"params\\\":{\\\"field\\\":\\\"@timestamp\\\",\\\"useNormalizedEsInterval\\\":true,\\\"interval\\\":\\\"auto\\\",\\\"drop_partials\\\":false,\\\"min_doc_count\\\":0,\\\"extended_bounds\\\":{}}},{\\\"id\\\":\\\"c59dceda-f6be-46f4-804a-fe4c53613e4e\\\",\\\"enabled\\\":true,\\\"type\\\":\\\"count\\\",\\\"schema\\\":\\\"metric\\\",\\\"params\\\":{}}]\" | lens_rename_columns idMap=\"{\\\"col-0-b171f1a0-ea9d-4937-9
@soulteary
soulteary / gitea-docker-restore.sh
Last active April 4, 2021 02:35
Gitea data restore script (docker)
#!/bin/sh
# Gitea data restore script (docker)
# Usage: ./restore.sh gitea-dump-1617385736.zip DockerIdOrDockerName
BACKUP_FILE=$1
CONTAINER_NAME=$2
if [ -f "$BACKUP_FILE" ]; then
if [ ! -z "$CONTAINER_NAME" -a "$CONTAINER_NAME" != " " ]; then
docker cp $BACKUP_FILE $CONTAINER_NAME:/tmp
# HG changeset patch
# User Dmitry Volyntsev <[email protected]>
# Date 1632256177 0
# Tue Sep 21 20:29:37 2021 +0000
# Node ID cc2b995738cdad13144ced7bfcd316475c14a049
# Parent 6feba0e602eeaa963aaf878dc6aa84b8ce2a668e
Introduced WebCrypto API according to W3C spec.
The following methods were implemented:
crypto.getRandomValues()