Skip to content

Instantly share code, notes, and snippets.

View max747's full-sized avatar

max747 max747

  • Xross Soft, LLC.
  • Osaka, Japan
View GitHub Profile
@max747
max747 / zipcsv.py
Created January 11, 2024 10:03
zip ファイル内に含まれる特定の CSV ファイルを明示して読み取る例
#!/usr/bin/env python3
"""
zip ファイル内に含まれる特定の CSV ファイルを明示して読み取る例
"""
import argparse
import csv
import io
import zipfile
@max747
max747 / s3get.py
Last active December 15, 2023 03:40
Get a file from S3 with boto3
#!/usr/bin/env python3
import argparse
import logging
from pathlib import Path
import boto3
logger = logging.getLogger(__name__)
@max747
max747 / tcp_close_serv.py
Created January 17, 2023 09:03
Server-side implementation to reproduce "Connection reset by peer"
#!/usr/bin/env python3
import logging
import socket
import struct
import time
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, format="[%(levelname)s] %(message)s")
s = socket.socket(socket.AF_INET6)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
@max747
max747 / csharp.md
Last active February 25, 2021 11:45
C# のメモ

C# のメモ

C# のコードを読む機会があったので、調べたことを記録しておく。

前提

MS の日本語ドキュメントは機械翻訳なので時々意味不明。英語で読んだ方がいいかも?

@max747
max747 / report_format.md
Last active January 31, 2021 12:49
FGO周回報告の書式

FGO周回報告ツイートの書式

はじめに

2021年1月時点での情報です。

報告ツイート書式統一の意味

黎明期と比べて現在の周回報告の数は段違いに多く、少ない日で1日あたり30件、多い日では100件もの報告ツイートがあります。もはや1件1件を丁寧に Twitter から拾い上げて集計環境に登録...というのは現実的ではなく、日々上がってくる大量の報告を効率よく収集、集計するためにツールの活用が必須条件となっています。

@max747
max747 / collecting_reports.md
Last active January 31, 2021 07:22
FGO周回報告と収集、集計

はじめに

2021年1月時点での環境について書いています。

現在の周回報告集計環境

次のような手続きで行われています。

  1. 報告者のみなさんがハッシュタグ #FGO周回カウンタ を含む報告をツイートする
  2. 集計人が周回報告ツイート収集ソフト syutagcnt を起動、実行して報告ツイートを収集する
@max747
max747 / main.py
Last active July 17, 2020 13:59
ソート実装案
class ItemOrdering:
regular_items = {
'爪': 10,
'心臓': 20,
'逆鱗': 30,
'根': 40,
}
# TODO 実際にはここは動的に設定することになるだろう
event_items = {
'チップ': 10010,
@max747
max747 / gist:f4c2f90a46bd9411b955040c34f7a7d5
Created January 7, 2020 06:13
an example of models.TextChoices (django 3.0+)
% python ./manage.py shell
Python 3.7.6 (default, Dec 19 2019, 17:29:22)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.db import models
>>>
>>> class FooChoices(models.TextChoices):
... Apple = 'A', 'りんご'
... Banana = 'B', 'バナナ'
@max747
max747 / script_template.py
Created October 10, 2019 15:56
Python でコマンドラインスクリプトを書くときのテンプレート
#!/usr/bin/env python3
"""
概要
"""
import argparse
import logging
logging.basicConfig(level=logging.INFO)
@max747
max747 / Dockerfile
Created March 1, 2018 03:48
build python 3.6 on Docker-centos7
FROM centos:7
ARG PYTHON_VERSION=3.6.4
ARG BUILD_DIR=/usr/local/src
RUN yum -y update && \
yum -y install vim wget xz make gcc zlib-devel bzip2 bzip2-devel \
xz-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel \
libffi-devel ncurses-devel gdbm-devel
WORKDIR ${BUILD_DIR}