Skip to content

Instantly share code, notes, and snippets.

View MainDec.java
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
public class MainDec {
private static final String basePath = "/Users/wkgcass/Downloads/三清叶子/";
private static final String input = "result4.png";
private static final String output = "result4dec.png";
@wkgcass
wkgcass / Main.java
Created Jul 20, 2022
list-window-info
View Main.java
import com.sun.jna.Native;
import com.sun.jna.Structure;
import com.sun.jna.win32.StdCallLibrary;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class Main {
View change-volume.ps1
$def = @"
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
namespace SetAppVolume
{
public class AppMuter
{
public static void Mute(string app)
@wkgcass
wkgcass / X.java
Last active May 24, 2022
AntiXXN.java
View X.java
import javax.net.ssl.SSLParameters;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.Date;
import java.util.concurrent.atomic.AtomicLong;
public class X {
View 消息格式.md

消息格式

{
  "@type": "消息类型", // 使用@type,是因为这样可以直接利用一些json库的特性,直接反序列化到指定类型的bean
  "seq": 1, // 消息序号,long类型,从一个随机正数开始自增,通信的两端都有自己的seq
  "ack": 0, // 响应序号,0或者无该字段表示本条消息不响应任何一条消息。负数需配合type使用,-1到-65536暂作保留
  // 其余消息内容,视type而定
}
@wkgcass
wkgcass / TimeElemImpl.java
Last active Jan 10, 2021
TimeWheel example (TODO)
View TimeElemImpl.java
package vproxybase.util.time.timewheel;
import vproxybase.util.LogType;
import vproxybase.util.Logger;
import vproxybase.util.time.TimeElem;
public class TimeElemImpl<T> implements TimeElem<T> {
final long timeoutTs;
private final T value;
@wkgcass
wkgcass / test.c
Created Jan 6, 2021
lsqpack demo
View test.c
#include <stdio.h>
#include <stdlib.h>
#include "lsqpack.h"
#include "lsxpack_header.h"
void dhi_unblocked(void* hblock_ctx) {
printf("dhi_unblocked\n");
}
typedef struct st_hblock_ctx {
@wkgcass
wkgcass / try-windows-ovpn-tap.c
Created May 1, 2020
use windows openvpn tap
View try-windows-ovpn-tap.c
#define USERMODEDEVICEDIR "\\\\.\\Global\\"
#define SYSDEVICEDIR "\\Device\\"
#define USERDEVICEDIR "\\DosDevices\\Global\\"
#define TAP_WIN_SUFFIX ".tap"
#include <stdio.h>
#include <fcntl.h>
#include <windows.h>
#include <unistd.h>
#include <io.h>
@wkgcass
wkgcass / kcp.java
Created Dec 3, 2019
Fix using kcp with rsock (java impl from kcp-netty)
View kcp.java
// base code: Copyright (c) 2017 Zheng Sun, from project kcp-netty
// added part: Copyright (c) 2019 wkgcass
public int input(ByteBuf data) {
long oldSndUna = sndUna;
long maxack = 0;
boolean flag = false;
if (log.isDebugEnabled()) {
log.debug("{} [RI] {} bytes", this, data.readableBytes());
}
View set_cpu_usage.py
import sys
import random
import time
TARGET = -1
ADJUST_THRESHOLD = 100
CNT_MIN = 0
SLP_MIN = 1
SLP_MAX = 10