Skip to content

Instantly share code, notes, and snippets.

View JmPotato's full-sized avatar
🤯
滅茶苦茶

JmPotato JmPotato

🤯
滅茶苦茶
View GitHub Profile
@JmPotato
JmPotato / sort_unstable_benchmark.rs
Last active February 27, 2022 09:25
sort_unstable_benchmark
#![feature(sort_internals)]
use std::{
fs::OpenOptions,
io::{Read, Write},
path::Path,
};
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use rand::{rngs::StdRng, Rng, SeedableRng};
@JmPotato
JmPotato / sign.sh
Created August 17, 2020 09:25 — forked from disksing/sign.sh
Sign off commit history
#!/bin/bash
# Add missing DCOs for current branch (starting from merge base to master)
# Following commit history as an example, this script will affect commits E,F,G.
#
# v master
# A - B - C - D - H - I
# \
# E - F - G
# ^ feature (HEAD)
@JmPotato
JmPotato / 📊 Weekly development breakdown
Last active May 16, 2023 17:39
📊Weekly development breakdown
Go 2 hrs 48 mins ███████▎░░░░░░░░░░░░░ 34.9%
Bash 2 hrs 17 mins █████▉░░░░░░░░░░░░░░░ 28.6%
Makefile 2 hrs █████▏░░░░░░░░░░░░░░░ 24.9%
Rust 31 mins █▍░░░░░░░░░░░░░░░░░░░ 6.6%
Python 15 mins ▋░░░░░░░░░░░░░░░░░░░░ 3.3%
@JmPotato
JmPotato / middleware_closure_implement.py
Created October 22, 2019 17:05
A server model with middleware support by using closure
# 上下文类,本例中主要用于存储当前调用的下文,即内层中间件
class Context():
def __init__(self):
self._next = []
@property
def next(self):
return self._next
@JmPotato
JmPotato / Markdown.py
Created August 2, 2014 14:09
Mistune and pygments Render
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import mistune
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_by_name
@JmPotato
JmPotato / AutoSave.js
Last active August 29, 2015 14:03
JavaScript AutoSave
function AutoSave(it) {
var _value = it.value;
if (_value) {
var expDays = 30;
var exp = new Date();
exp.setTime( exp.getTime() + (expDays * 86400000) );
var expires='; expires=' + exp.toGMTString();
document.cookie = "AutoSaveContent=" + escape (_value) + expires;
@JmPotato
JmPotato / SQLTools.py
Last active August 29, 2015 13:56
A lightweight wrapper around sqlite3; based on tornado.database
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
import itertools
class Connection(object):
"""
A lightweight wrapper around sqlite3; based on tornado.database
@JmPotato
JmPotato / Login.cs
Last active December 20, 2015 23:08
Minecraft 正版验证
try
{
label7.Text = "登录中...";
string url = "https://login.minecraft.net/?user=" + Program.username + "&password=" + password + "&version=13";
WebClient client = new WebClient();
Stream data = client.OpenRead(url);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
Console.WriteLine(s);
data.Close();
@JmPotato
JmPotato / Launcher.cs
Last active December 20, 2015 23:08
Minecraft 启动函数
public static void StartGame(string JavaPath, string max_memory, string playername, string version, bool login, string login_parameter)
{
string path = System.Environment.CurrentDirectory;
string command = "";
if (login)
{
if (version == "旧版(1.5.2及以下版本)")
{
command = String.Format("\"{0}\" -Xincgc -Xmx{3}m -cp \"{1}\\.minecraft\\bin\\minecraft.jar;{1}\\.minecraft\\bin\\lwjgl.jar ;{1}\\.minecraft\\bin\\lwjgl_util.jar;{1}\\.minecraft\\bin\\jinput.jar\" -Djava.library.path=\"{1}\\.minecraft\\bin\\natives\" net.minecraft.client.Minecraft {2}", JavaPath, path, login_parameter, max_memory);
}