Skip to content

Instantly share code, notes, and snippets.

@GNQG
GNQG / mstdnjp.py
Last active April 23, 2017 12:05
Mastodon.pyでmstdn.jpのstreamを使いたいときの面倒をなくすあれ
#coding: utf-8
'''
mstdnjp.py - subclass of mastodon.Mastodon for mstdn.jp
original: Mastodon.py (MIT license)
https://github.com/halcy/Mastodon.py
license of this code: MIT license
http://opensource.org/licenses/mit-license.php
'''
@GNQG
GNQG / bmsext.ps1
Last active October 14, 2016 00:37
Extract BMS archives with appropriate directory structure
function Get-CommonDirectoryPath($paths){
# original: https://www.rosettacode.org/wiki/Find_common_directory_path#PowerShell
switch($paths.Count){
0{return $null}
1{
$s=$paths[0].TrimStart('/').Split('/')
$v=''
for($r = 0; $r -lt $s.Count-1; $r++) {
$v+=$s[$r]
}
@GNQG
GNQG / dee2.py
Created September 8, 2016 11:44
from urllib import urlencode
from urllib2 import urlopen,HTTPError,URLError
import socket
import re
import json
try:
from unescape_charref import unescape_charref
except ImportError:
unescape_charref=None
@GNQG
GNQG / unescape_charref.py
Created September 5, 2016 15:02
unescaping character entity references / numeric character references with Python2.x
import re
import sys
from htmlentitydefs import name2codepoint
def unescape_charref(escaped):
def uchr(c):
if 0<c<=sys.maxunicode:
# BMP(UCS-2) / whole(UCS-4)
return unichr(c)
elif sys.maxunicode<c<=0x10ffff:
@GNQG
GNQG / 3rdln_grade_1.json
Created December 19, 2015 13:07
JSONs for exgrade
{
"name" : "第3期LN段位認定#1",
"order" : [
[7335, "◆01"],
[7334, "◆02"],
[7333, "◆03"],
[7332, "◆04"],
[7331, "◆05"],
[7330, "◆06"],
[7329, "◆07"],