Skip to content

Instantly share code, notes, and snippets.

@altnight
altnight / 20240718.md
Last active July 18, 2024 07:10
2024/07/18 アプリケーションコードにおいてデフォルト値は原則として使用しない方がよい

2024/07/18 アプリケーションコードにおいてデフォルト値は原則として使用しない方がよい

結論

  • アプリケーションコードにおいて、デフォルト値は原則として使用しない方がよい

前提

  • ライブラリ/フレームワーク/ツールのような、不特定のユーザーが使用するコードではない
  • 主にWebアプリケーションの開発
@altnight
altnight / 20240620.md
Created June 20, 2024 06:18
2024/06/20 2024年6月時点でのPythonでのWebAPIの実装について(FastAPI, GraphQL, DRF, Django Ninja)

2024/06/20 2024年6月時点でのPythonでのWebAPIの実装について(FastAPI, GraphQL, DRF, Django Ninja)

結論

FastAPI

@altnight
altnight / 20240516.md
Last active May 16, 2024 06:36
2024/05/16 Git(GitHub)リポジトリの運用

2024/05/16 Git(GitHub)リポジトリの運用

自分の昨今の開発では、ほとんどGit(GitHub)を使っている。今回はそのあたりの情報やポリシーを整理してみた。Gitの話とGitHubの話は多少混ぜている。

触れていること

  • コミット(メッセージ/履歴)
  • ブランチ(命名/管理)
  • マージ
  • PR
@altnight
altnight / one.rb
Last active May 4, 2018 05:52
sonic pi harm
define :one do
8.times do
play (scale :e3, :harmonic_minor).tick, release: 0.1
sleep 0.125
end
8.times do
play (scale :d4, :harmonic_minor).tick, release: 0.1
sleep 0.125
end
8.times do
d = {
"success": True,
"calendars": [
{
"id": 123,
"year": 2014,
"months": [
{
"id": 50,
"monthnumber": 1,
"""
- https://speakerdeck.com/anatoo/phpdexue-buvmxing-zheng-gui-biao-xian-enzinfalseshi-zu-mi
- http://blog.asial.co.jp/1221
"""
import copy
class RegexVMThread(object):
def __init__(self):
self.string_pointer = 0
# -*- coding: utf-8 -*-
def parse_input_string(strs):
import shlex
parsed = shlex.split(cmd)
print(parsed)
return parsed
cmd = 'hoge | moge 1 | insert_delimiter ! | whitespace'
parsed = parse_input_string(cmd)
@altnight
altnight / playbook.yml
Created May 6, 2014 14:51
ansible playbook for install python 3.4
---
- hosts: 127.0.0.1
connection: local
user: (user)
vars:
tmpdir: "/Users/(user)/tmpfile/python"
name: "Python"
version: "3.4.0"
tasks:
- name: "make dir"
@altnight
altnight / client.py
Created November 2, 2013 10:02
ソケットからやりなおす まずは公式から http://docs.python.jp/2.7/library/socket.html#socket-example
#!/usr/bin/env python
# coding: utf-8
import sys
import socket
HOST = 'localhost'
PORT = 50007
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
@altnight
altnight / import_this.py
Created November 2, 2013 09:10
「UNIXという考え方」に近い気がする
>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.