data.py
from dataclasses import dataclass, field
@dataclass
class Maker:
#!/bin/sh | |
yes_or_no() | |
{ | |
case `echo "$1" | tr A-Z a-z` in | |
"y"|"yes"|"on"|"true") | |
echo "'$1' is YES!!!" | |
;; | |
"n"|"no"|"off"|"false") | |
echo "'$1' is NO!!!" |
## 表示 | |
# 最新リリースのすべてのアセットファイルを表示する | |
curl -s https://api.github.com/repos/PowerShell/PowerShell/releases/latest | jq -r '.assets[].name' | |
# 最新リリースの"win"を含むアセットファイルをすべて表示する | |
curl -s https://api.github.com/repos/PowerShell/PowerShell/releases/latest | jq -r '.assets[] | select(.name | test("win")) | .name' | |
# 最新リリースの"win"を含むzipのアセットファイルをすべて表示する | |
curl -s https://api.github.com/repos/PowerShell/PowerShell/releases/latest | jq -r '.assets[] | select(.name | test("win.*\\.zip")) | .name' |
#!/bin/sh | |
# basic | |
sqlite3 database.sqlite ".backup backup.sqlite" | |
# timestamp | |
sqlite3 database.sqlite ".backup backup_$(date '+%Y%m%dT%H%M%S%z').sqlite" |
#!/bin/sh | |
# /mnt/backupにあるbackup_で始まって.gzで終わるファイルのうち、最新の5つ以外を削除する | |
# [前提] backup_20210203.gz のようなファイル名に日時が入っており最新順に整列可能なこと。 | |
: "${target_dir:=/mnt/backup}" | |
: "${prefix:=backup_}" | |
: "${suffix:=.gz}" | |
: "${keep_count:=5}" |
import threading | |
import time | |
import PySimpleGUI as sg | |
def long_time_process(): | |
time.sleep(5) | |
import threading | |
import asyncio | |
import PySimpleGUI as sg | |
from requests_html import AsyncHTMLSession | |
import pyppeteer | |
async def print_page_title(window): | |
session = AsyncHTMLSession() |
from dataclasses import dataclass, field | |
def get_member(cls) -> list[str]: | |
return [x for x in dir(cls) if not x.startswith("_")] | |
@dataclass | |
class Product: | |
# If you do not specify a field, that field will not be detected. |
from .util import replace_invalid_char | |
extension_map = { | |
"&": "&", | |
"(": "(", | |
")": ")", | |
"[": "[", | |
"]": "]", | |
"{": "{", | |
"}": "}", |
const unique = <T>(targets: Array<T[]>): T[] => { | |
return [ | |
...new Set( | |
targets.reduce((result, current) => { | |
return result.concat(current) | |
}, []) | |
), | |
] | |
} |