Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

JmPotato JmPotato

🎯
Focusing
View GitHub Profile
@JmPotato
JmPotato / sign.sh
Created Aug 17, 2020 — forked from disksing/sign.sh
Sign off commit history
View sign.sh
#!/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 Dec 3, 2021
📊Weekly development breakdown
View 📊 Weekly development breakdown
Go 4 hrs 8 mins █████████████████▊░░░ 84.8%
Markdown 16 mins █▏░░░░░░░░░░░░░░░░░░░ 5.8%
Rust 16 mins █▏░░░░░░░░░░░░░░░░░░░ 5.6%
Other 5 mins ▍░░░░░░░░░░░░░░░░░░░░ 1.9%
YAML 3 mins ▏░░░░░░░░░░░░░░░░░░░░ 1.1%
@JmPotato
JmPotato / middleware_closure_implement.py
Created Oct 22, 2019
A server model with middleware support by using closure
View middleware_closure_implement.py
# 上下文类,本例中主要用于存储当前调用的下文,即内层中间件
class Context():
def __init__(self):
self._next = []
@property
def next(self):
return self._next
@JmPotato
JmPotato / Markdown.py
Created Aug 2, 2014
Mistune and pygments Render
View Markdown.py
#!/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 Aug 29, 2015
JavaScript AutoSave
View AutoSave.js
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 Aug 29, 2015
A lightweight wrapper around sqlite3; based on tornado.database
View SQLTools.py
#!/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 Dec 20, 2015
Minecraft 正版验证
View Login.cs
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 Dec 20, 2015
Minecraft 启动函数
View Launcher.cs
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);
}