Skip to content

Instantly share code, notes, and snippets.

View yale8848's full-sized avatar
🐯
Tiger Year

Yale yale8848

🐯
Tiger Year
View GitHub Profile
@Youngv
Youngv / WSL2.bat
Last active February 21, 2025 14:32
给 WSL2 和 Host 设置静态 IP 地址,每次重启 Host 或 WSL2 后运行
@ECHO OFF
wsl -d Ubuntu-20.04 -u root ip addr del $(ip addr show eth0 ^| grep 'inet\b' ^| awk '{print $2}' ^| head -n 1) dev eth0
wsl -d Ubuntu-20.04 -u root ip addr add 192.168.50.2/24 broadcast 192.168.50.255 dev eth0
wsl -d Ubuntu-20.04 -u root ip route add 0.0.0.0/0 via 192.168.50.1 dev eth0
wsl -d Ubuntu-20.04 -u root echo nameserver 192.168.50.1 ^> /etc/resolv.conf
powershell -c "Get-NetAdapter 'vEthernet (WSL)' | Get-NetIPAddress | Remove-NetIPAddress -Confirm:$False; New-NetIPAddress -IPAddress 192.168.50.1 -PrefixLength 24 -InterfaceAlias 'vEthernet (WSL)'; Get-NetNat | ? Name -Eq WSLNat | Remove-NetNat -Confirm:$False; New-NetNat -Name WSLNat -InternalIPInterfaceAddressPrefix 192.168.50.0/24;"
@17twenty
17twenty / ratelimitMyCopy.go
Created June 14, 2017 08:39
Demo of using golang.org x time rate RateLimiter
package main
import (
"bytes"
"fmt"
"io"
"time"
"golang.org/x/time/rate"
)
@higebu
higebu / connect_with_specific_source_port.go
Created May 16, 2016 03:48
Golang: Connect with specific source port
package main
import (
"bufio"
"fmt"
"log"
"net"
)
func main() {
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('image.jpg', cv2.IMREAD_GRAYSCALE)
def compute_skew(image):
image = cv2.bitwise_not(image)
height, width = image.shape