Skip to content

Instantly share code, notes, and snippets.

View KatagiriSo's full-sized avatar

KatagiriSo KatagiriSo

View GitHub Profile
@KatagiriSo
KatagiriSo / jointest.sql
Created November 27, 2023 08:24
sqlite3 inner joinとleft joinの例
--- sqlite3 inner joinとleft joinの例
-- table Hogeがあったら削除
drop table if exists Hoge;
-- table Hogeがなかったら作る
create table if not exists Hoge (
name varchar(255) not null,
age int not null
type UseSWR<T> = typeof useSWR<
T,
unknown,
Partial<PublicConfiguration<T, unknown, BareFetcher<T>>> | undefined
>
const getHoge: UseSWR<Hoge> = useSWR
@KatagiriSo
KatagiriSo / pcregrep.md
Created February 9, 2023 02:42
pcregrep

pcregrepは複数行のgrepとして使える。

@KatagiriSo
KatagiriSo / gist:130a38e950b921a2be106647a1a3ead5
Created December 13, 2022 09:29
TypeOrmのDataSource周り.md

https://typeorm.io/

typeormのDataSouce周りを調べてみましたのでまとめます。

TypeOrmのDataSource

DataSourceの初期化はDataSourceインスタンスのinitializeメソッドを呼び出して行う。 DataSourceの生成でDBの設定をする。

設定

@KatagiriSo
KatagiriSo / rename2.py
Created October 22, 2020 11:35
ファイル名加工
import glob
import os
import re
paths = glob.glob("./*.*.json")
for path in paths:
file = os.path.basename(path)
pattern = r".*\.(.*\.json)"
@KatagiriSo
KatagiriSo / rename.py
Created October 22, 2020 11:33
ファイル名変更
import os
path = "./hogehoge.txt"
distpath = "./hogehoge2.txt"
os.rename(path, distpath)
@KatagiriSo
KatagiriSo / matchlastComma.py
Created October 22, 2020 11:33
最後のカンマをみつける
import re
import glob
txt = "hogehoge[abccbbss, bccc, [caaa, caaa], abb,]"
def matchlastComma(txt):
pattern = r"(.*),"
m = re.findall(pattern, txt, flags=(re.MULTILINE | re.DOTALL))
if len(m) == 0:
@KatagiriSo
KatagiriSo / fileopen
Created October 22, 2020 11:31
ファイル読むこむ
import os
path = "./hogehoge.txt"
with open(path, mode='w') as f:
f.write("a")
with open(path) as f:
t = f.read()
print(t)
@KatagiriSo
KatagiriSo / filelist.py
Created October 22, 2020 11:31
ファイルリスト
import glob
files = glob.glob("./*")
for file in files:
print(file)
@KatagiriSo
KatagiriSo / createfile.py
Created October 22, 2020 11:30
ファイル作成
import os
path = "./hogehoge.txt"
with open(path, mode="w") as f:
f.write("a")