Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

JmPotato JmPotato

🎯
Focusing
Block or report user

Report or block JmPotato

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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);
}
You can’t perform that action at this time.