Skip to content

Instantly share code, notes, and snippets.

Loui Sakaki LouiS0616

Block or report user

Report or block LouiS0616

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
View convert.py
import pathlib
import re
import cv2
import numpy as np
import tqdm
_color_convert_dct = {
# B G R
View priority_dict.py
import collections
import collections.abc
class PriorityDict(collections.abc.MutableMapping):
def __init__(self, default_priority_func):
self._default_priority_func = default_priority_func
self._inner_keys = set()
View namedzip.py
class NamedZip:
def __init__(self, dct=None, **kwards):
if dct:
kwards = {**dct, **kwards}
self._names = kwards.keys()
self._iters = [
iter(val) for val in kwards.values()
]
View split_img.py
from pathlib import Path
import cv2
import numpy as np
from tqdm import tqdm
def main(filename):
# 画像を読み込む
View MyFraction.py
import math
def compute_lcm(a, b):
return (a * b) // math.gcd(a, b)
class MyFraction:
def __init__(self, numerator, denominator=1):
if denominator == 0:
raise ValueError
View printable_func.py
def printable_func(str_func=None):
if str_func is None:
str_func = lambda func: func.__name__
def inner(func):
return type(
func.__name__, (object, ),
{
**vars(func),
'__call__':
View morepathlib.py
from pathlib import Path
_Path = type(Path())
class Path(_Path):
def __iter__(self):
if self.is_dir():
return self.iterdir()
raise TypeError
@LouiS0616
LouiS0616 / LICENSE
Created Apr 6, 2018
This license applies to all public gists https://gist.github.com/LouiS0616
View LICENSE
MIT License
Copyright (c) 2018 Loui Sakaki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
View cv_util.py
"""
OpenCV utility functions.
"""
from functools import singledispatch
import cv2
BackendError = type('BackendError', (Exception,), {})
def _is_visible(winname):
try:
@LouiS0616
LouiS0616 / HoldableButton.java
Last active Mar 15, 2018
Holdable button sample.
View HoldableButton.java
public class HoldableButton extends AppCompatButton {
private int delayMsec;
private int intervalMsec;
private MainTask mainTask;
private final Handler handler = new Handler();
private Runnable runnableCode;
//
//
You can’t perform that action at this time.