本ではそれぞれ別のターミナルで起動してくださいという趣旨の説明があるんですが面倒なんで。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail | |
shopt -s nullglob | |
# if command starts with an option, prepend mysqld | |
if [ "${1:0:1}" = '-' ]; then | |
set -- mysqld "$@" | |
fi | |
# skip setup if they want an option that stops mysqld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wordpress: | |
image: wordpress:latest | |
links: | |
- db:mysql | |
ports: | |
- '127.0.0.1:8080:80' | |
db: | |
image: mariadb:latest | |
environment: | |
MYSQL_ROOT_PASSWORD: password123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# In this code we investigate how to "gracefully" exit all child processes | |
# and threads. "Gracefully" implies "each thread/process gets through the | |
# whole release work before exitting, minimizing the lisk of resource leaks or | |
# other unexpected behaviors" | |
# | |
# In the real world, it may be OK just to use thread.daemon = True or | |
# process.daemon = True, especially if you do not care of long term stability. | |
# Container technology may allow that kind of rough edges in your codes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# c.f. "Fluent Python" (Ja) p577 | |
# | |
import asyncio | |
import aiohttp | |
import sys | |
import time | |
POP20_CC = ['CN', 'IN', 'US', 'ID', 'BR', 'PK', 'NG', 'BD', 'RU', 'JP', | |
'MX', 'PH', 'VN', 'ET', 'EG', 'DE', 'IR', 'TR', 'CD', 'FR'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ hexdump -C <(curl -sS https://twitter.com/________Kee/status/969785495424180225) | grep -A 3 'e3 83 88 20' | |
00001350 30 3b e3 83 86 e3 82 b9 e3 83 88 20 e7 a4 be ef |0;......... ....| | |
00001360 b8 80 ef b8 80 e2 80 a6 20 26 71 75 6f 74 3b 3c |........ "<| | |
00001370 2f 74 69 74 6c 65 3e 0a 20 20 20 20 20 20 3c 6d |/title>. <m| | |
00001380 65 74 61 20 6e 61 6d 65 3d 22 72 6f 62 6f 74 73 |eta name="robots| | |
-- | |
00002cc0 e3 83 88 20 e7 a4 be ef b8 80 ef b8 80 e2 80 a6 |... ............| | |
00002cd0 20 26 71 75 6f 74 3b 22 3e 0a 0a 0a 20 20 3c 6c | "">... <l| | |
00002ce0 69 6e 6b 20 72 65 6c 3d 22 61 6c 74 65 72 6e 61 |ink rel="alterna| | |
00002cf0 74 65 22 20 6d 65 64 69 61 3d 22 68 61 6e 64 68 |te" media="handh| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/sha256" | |
"fmt" | |
"math/rand" | |
"time" | |
"runtime" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import functools | |
# メモ化を行うデコレータ | |
# 戻り値をキャッシュするのでprint()は使わないように | |
@functools.lru_cache() | |
def stairs(n): | |
if n < 0: | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# http://neuro-educator.com/rl1/ | |
# | |
import gym # 倒立振子(cartpole)の実行環境 | |
import numpy as np | |
import time | |
# カート位置 -2.4~2.4 | |
# カート速度 -3.0~3.0 |
NewerOlder