Skip to content

Instantly share code, notes, and snippets.

@GNQG
GNQG / mstdnjp.py
Last active Apr 23, 2017
Mastodon.pyでmstdn.jpのstreamを使いたいときの面倒をなくすあれ
View mstdnjp.py
#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 Oct 14, 2016
Extract BMS archives with appropriate directory structure
View bmsext.ps1
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]
}
View dee2.py
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 Sep 5, 2016
unescaping character entity references / numeric character references with Python2.x
View unescape_charref.py
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:
View 3rdln_grade_1.json
{
"name" : "第3期LN段位認定#1",
"order" : [
[7335, "◆01"],
[7334, "◆02"],
[7333, "◆03"],
[7332, "◆04"],
[7331, "◆05"],
[7330, "◆06"],
[7329, "◆07"],
You can’t perform that action at this time.