Skip to content

Instantly share code, notes, and snippets.

View wfjsw's full-sized avatar

Jianshu Wang wfjsw

View GitHub Profile
@wen-long
wen-long / ss-redir 透明代理.md
Last active March 18, 2024 12:13
ss-redir 透明代理.md

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
@lolzballs
lolzballs / HelloWorld.java
Created March 22, 2015 00:21
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
@liberize
liberize / captcha.py
Last active April 7, 2019 15:09
简单验证码识别
#!/usr/bin/env python
# coding: utf-8
import os
import sys
from PIL import Image, ImageChops
templates = []
@JonathonReinhart
JonathonReinhart / pipe_client.py
Last active August 8, 2024 12:27
Named Pipes between C# and Python
import time
import struct
f = open(r'\\.\pipe\NPtest', 'r+b', 0)
i = 1
while True:
s = 'Message[{0}]'.format(i).encode('ascii')
i += 1
@vijinho
vijinho / markdown_escape.php
Last active September 22, 2024 22:37
Escape markdown in php
<?php
/**
* Escape markdown text
*
* @param string $text the markdown text to escape
*
* @return string escaped text
*/
function markdown_escape($text) {
return str_replace([
@mmozeiko
mmozeiko / !README.md
Last active November 14, 2024 21:35
Download MSVC compiler/linker & Windows SDK without installing full Visual Studio

This downloads standalone MSVC compiler, linker & other tools, also headers/libraries from Windows SDK into portable folder, without installing Visual Studio. Has bare minimum components - no UWP/Store/WindowsRT stuff, just files & tools for native desktop app development.

Run py.exe portable-msvc.py and it will download output into msvc folder. By default it will download latest available MSVC & Windows SDK - currently v14.40.33807 and v10.0.26100.0.

You can list available versions with py.exe portable-msvc.py --show-versions and then pass versions you want with --msvc-version and --sdk-version arguments.

To use cl.exe/link.exe first run setup_TARGET.bat - after that PATH/INCLUDE/LIB env variables will be updated to use all the tools as usual. You can also use clang-cl.exe with these includes & libraries.

To use clang-cl.exe without running setup.bat, pass extra /winsysroot msvc argument (msvc is folder name where output is stored).

@wfjsw
wfjsw / convert-pt-embedding-to-png.ipynb
Last active November 24, 2022 00:50
convert-pt-embedding-to-png.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AmericanPresidentJimmyCarter
AmericanPresidentJimmyCarter / compress.py
Last active March 17, 2023 18:48
Attempting to make small DB patches
import argparse
from pathlib import Path
import sys
import torch
THRESHOLD_STRENGTH = 2.
DEFAULT_OUT_NAME = 'output.ckpt'
parser = argparse.ArgumentParser(description='Create a compressed dreambooth patch or patch weights')
parser.add_argument('mode', type=str, help='"compress" or "inflate"')