Skip to content

Instantly share code, notes, and snippets.

@NyaMisty
NyaMisty / chinese_checker.xml
Created April 15, 2024 11:11
Overleaf Copilot 中文语法检查器
<agent name="中文 Checker">
<icon mdi="text-search-variant" />
<desc>中文语法检查</desc>
<model temperature="0.7">gpt-3.5-turbo-16k</model>
<def>
<render-diff>
<join-diff format="html">
<diff unit="char"> <!-- 必须是char,因为word模式没法匹配 -->
<source>
<input />
@NyaMisty
NyaMisty / phpbb_concat.go
Created March 25, 2024 18:43
phpbb concat
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
"regexp"
@NyaMisty
NyaMisty / mount_zfs_snapshot.sh
Created February 23, 2024 14:36
Recursively mount ZFS snapshot for a dataset
#!/bin/bash
# Change these parameters
mntdir=/mnt/cache/_tmp_restic-snapshot
dataset_name="cache"
datasets=($(zfs list -t filesystem -H | cut -d$'\t' -f1 | grep -E '^'$dataset_name'(/|$)'))
echo "Datasets selected: ${datasets[@]}"
for d in "${datasets[@]}"; do
mntsubdir=${d#"$dataset_name"}
@NyaMisty
NyaMisty / damage.c
Last active January 26, 2024 08:37
Evol deepspace damage calculation
// local variable allocation has failed, the output may be wrong!
__int64 __fastcall DamageFormula__CalcDamage(
DamageInfo **damageInfo,
void *damageExporter,
Actor *damageTaker,
Actor *assistor,
HitParamConfig *hitParamConfig,
float hurtAddAngle,
float damageProportion,
char isCritical,
@NyaMisty
NyaMisty / _CoCoPilot.md
Last active January 26, 2024 03:44
A small snippet to use CoCoPilot without patching Copilot plugin

cocopilot-gh-enterprise

Turn cocopilot into github enterprise server, so that we can use CoCoPilot without patching Copilot plugin.

Usage

  1. Add the following JS to a cloudflare worker.
  2. Add Cloudflare Worker Routes: *cocopilot-gh-enterprise.XXXXXXXX.XXX. You should also add DNS records cocopilot-gh-enterprise.XXXXXXXX.XXX & *.cocopilot-gh-enterprise.XXXXXXXX.XXX to make the route available image
  3. Setting GitHub Enterprise URL to cocopilot-gh-enterprise.XXXXXXXX.XXX
// https://op-prod-tr.ozan.com/api/(oauth/token\?grant_type=pre_verification|users/update-mobile-number)
const url = $request.url
var new_hdrs = {}
for (var k in $request.headers) {
new_hdrs[k.toLowerCase()] = $request.headers[k]
}
function main() {
if (url == 'https://op-prod-tr.ozan.com/api/oauth/token?grant_type=pre_verification') {
if (!($request.body.includes('mfa_code') && $request.body.includes('mfa_token'))) {
@NyaMisty
NyaMisty / http_fileobj.py
Created August 5, 2023 12:47
Python fileobj from HTTP, with ranged request!
import io
import requests
class HTTPFileObj:
def __init__(self, url, chunk_size=1024):
self.url = url
self.chunk_size = chunk_size
self.start_byte = 0 # Initialize start_byte here
self.buffer = b"" # Initialize buffer to store remaining data
self.max_size = -1
@NyaMisty
NyaMisty / main.mm
Created June 8, 2023 18:59
Login additional account on MacOS
#import <Foundation/Foundation.h>
@interface AMSBag : NSObject {}
+(id)bagForProfile:(id)arg1 profileVersion:(id)arg2 ;
+(id)bagForProfile:(id)arg1 profileVersion:(id)arg2 processInfo:(id)arg3 ;
-(NSString *)URLForKey:(NSString *)key;
@end
@interface ACAccount : NSObject {}
@end
@NyaMisty
NyaMisty / RemapCtrl.py
Last active February 22, 2023 20:51
Ghidra Script: Remap Ctrl&Meta to platform Ctrl key (i.e. Command on macOS, Ctrl on Win/Linux). Note: because Ghidra does not support running script on startup, you'll need to run this script manually on ech start :(
# Remap Ctrl&Meta to platform Ctrl key (i.e. Command on macOS, Ctrl on Win/Linux)
#@author NyaMisty
#@category UIHelper
#@keybinding Alt-C
#@menupath Edit.RemapCtrl
#@toolbar RemapCtrl
from javax.swing import KeyStroke
from java.awt.event import InputEvent
@NyaMisty
NyaMisty / GhidraIDA.md
Last active March 14, 2023 15:15
Misty's Ghidra IDA like experience

How to Use

  1. In Ghidra's Project Tool, Go to Tools -> Import Tool..., select mistyCodeBrowser.tool
  2. Dragging file onto the new CodeBrowser_1 in ToolChest