This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
class Case(object): | |
__slots__ = [] | |
def __init__(self, *args, **kwargs): | |
super_setattr = super(Case, self).__setattr__ | |
slots = self.__slots__[:] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
import re | |
from pypeg2 import * | |
""" | |
漢直 Win テーブル定義ファイルパーサ (要 python3) | |
Option: #define で定義される値 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def damerau_levenshtein_distance(s1, s2): | |
from pprint import pprint | |
from collections import defaultdict | |
if isinstance(s1, bytes) or isinstance(s2, bytes): | |
raise TypeError(_no_bytes_err) | |
len1 = len(s1) | |
len2 = len(s2) | |
infinite = len1 + len2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
atom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"reflect" | |
"regexp" | |
"runtime" | |
"strings" | |
"github.com/pkg/errors" | |
) | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"net/http" | |
"time" | |
cldatastore "cloud.google.com/go/datastore" | |
"google.golang.org/appengine" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "testing" | |
type I interface { | |
Hello() | |
} | |
type A struct {} | |
func (a A) Hello() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# js/ts npm package | |
## Command | |
``` | |
jq -r ".dependencies | keys | .[]" package.json | xargs -I{} npm view {} name license | |
``` | |
## Example | |
``` | |
$ jq -r ".dependencies | keys | .[]" package.json | xargs -I{} npm view {} name license |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import concurrent.futures | |
from threading import Semaphore | |
# ThreadPoolExecutor の _work_queue を差し替える方法もあるようだが、試したところ意図しない挙動になった(最後のタスクが終了しても制御が戻らない) | |
# https://stackoverflow.com/questions/48263704/threadpoolexecutor-how-to-limit-the-queue-maxsize | |
class ThreadPoolExecutorWithLimitedWorkQueue(concurrent.futures.ThreadPoolExecutor): | |
def __init__(self, max_queue_size, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
self.semaphore = Semaphore(max_queue_size) |
OlderNewer