Skip to content

Instantly share code, notes, and snippets.

@ykai55
ykai55 / apply_env.fish
Last active September 4, 2025 04:17
fish shell function to apply environment variables from a bash/sh script
# fish shell function to apply environment variables from a bash/sh script
function apply_env --description "source a .sh script and apply its env changes to the current fish shell"
argparse 'v/verbose' -- $argv
or return
# Check for input file
if test -z "$argv[1]"
echo "Usage: apply_env <path_to_script.sh>"
return 1
end
@ykai55
ykai55 / pb_reader.ts
Created December 3, 2024 03:11
PB reader
export enum PBType {
bool = 0,
bytes = 1,
double = 2,
float = 3,
int32 = 4,
int64 = 5,
string = 6,
uint32 = 7,
uint64 = 8,
@ykai55
ykai55 / mteam.user.js
Last active August 24, 2025 14:25
显示MTeam-余额(分享率大于3)
// ==UserScript==
// @name M-Team 余额
// @namespace http://tampermonkey.net/
// @version 2024-02-25
// @description try to take over the world!
// @author You
// @match https://kp.m-team.cc/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=m-team.cc
// @grant none
// ==/UserScript==
@ykai55
ykai55 / addon.py
Created December 20, 2021 17:42
mitmproxy asyncio request
from mitmproxy import http
import asyncio
def request(flow: http.HTTPFlow):
flow.intercept()
async def resume():
try:
await async_request(flow)
@ykai55
ykai55 / .ideavimrc
Last active December 24, 2021 08:46
ideavimrc
let mapleader=' '
"""" idea设置
" 导航
nnoremap gi :action GotoImplementation<cr>
nnoremap gu :action FindUsages<cr>
nnoremap gU :action FindUsagesInFile<cr>
nnoremap gd :action GotoDeclaration<cr>
nnoremap gs :action GotoSuperMethod<cr>
@ykai55
ykai55 / cluster.kt
Created May 12, 2020 10:07
cluster learning
package wekaTest
import weka.clusterers.AbstractClusterer
import weka.clusterers.FilteredClusterer
import weka.clusterers.SimpleKMeans
import weka.core.EuclideanDistance
import weka.core.Instances
import weka.core.SelectedTag
import weka.core.converters.ConverterUtils.DataSource
import weka.filters.unsupervised.attribute.Remove
@ykai55
ykai55 / poker.txt
Created June 16, 2019 15:42
ikbc poker PN-mode key map
PN mode:
j -> down
k -> up
h -> left
l -> right
Caps -> Ctrl_L
Ctrl_L -> Win
Fn + Caps -> Caps
@ykai55
ykai55 / jb_ide_config.md
Last active June 13, 2019 18:00
JetBrains IDE Config
Theme: Darcula
Custom UI Font: Source Han Sans CN Medium:16
Code Font: Source Code Pro Medium:18
  如果不介意加粗看不清的话,把Medium设置为Bold能更清晰
Code Scheme: One Dark/Darcula
@ykai55
ykai55 / restart_sleep.c
Created May 22, 2019 08:46
Restart sleep function in c
int t_remain;
for (t_remain = 2; t_remain = sleep(t_remain););
t_remain = 2;
while (t_remain = sleep(t_remain));
@ykai55
ykai55 / c_progress.c
Last active May 20, 2019 15:37
progress in c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int progress(char *buf, ssize_t bufsize,
int completed, int length,
char cell, char empty,
char begin, char end)
{
int i = 0;