Skip to content

Instantly share code, notes, and snippets.

# 命令書
あなたはシニアソフトウェアエンジニアです。
以下の制約条件と入力文をもとに改善されたコードおよびテストのためのコードを出力してください。
# 制約条件
- コードを変える場合は、その理由を説明する
- [X]を日本語とする
- 適切にGoogle Styleの[X]でdocstringを追加する
@satomacoto
satomacoto / Set_up_ScheduledFargateTask_and_EFS.py
Last active October 4, 2022 07:39
Set up ScheduledFargateTask and EFS
def setup_vpc(self):
self.vpc = aws_ec2.Vpc(
self,
"efs-testvpc",
nat_gateways=0,
subnet_configuration=[
aws_ec2.SubnetConfiguration(
name="efs-testsubnet-public",
subnet_type=aws_ec2.SubnetType.PUBLIC,
),
@satomacoto
satomacoto / logging_sample.ipynb
Created December 18, 2019 01:44
logging for jupyter
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@satomacoto
satomacoto / auth_sample.py
Created October 31, 2019 03:38
access api with jwt
import json
from urllib.request import urlopen
from urllib.request import Request
from urllib.parse import urlencode
# set username, password, auth_url, api_url
params = urlencode({"username": username, "password": password}).encode()
# get token
@satomacoto
satomacoto / sample.py
Created May 12, 2019 23:48
copy django FileFiled object to tempfile
import shutil
import tempfile
from app.models import Record
# %%
%%time
with tempfile.NamedTemporaryFile() as tmp:
record = Record.objects.first()
@satomacoto
satomacoto / download_with_requests.py
Created April 21, 2019 22:58
download with requests
import shutil
import requests
def download(url, dst):
response = requests.get(url, stream=True)
with open(str(dst), 'wb') as out_file:
shutil.copyfileobj(response.raw, out_file)
del response
@satomacoto
satomacoto / __README.md
Created March 17, 2019 22:23
How to add Slack incoming webhook
  1. https://api.slack.com/apps
  2. Create New App
  3. Set App Name and Development Slack Workspace
  4. Tap App to move Building Apps for Slack
  5. Add features and functionality
  6. Select Incoming Webhooks
  7. Add New Webhook to Workspace
(function() {
var language_info = {
languages_top: [
{ code: "de", name: "Deutsch" },
{ code: "en", name: "English", checked: true },
{ code: "es", name: "español" },
{ code: "es-419", name: "español (Latinoamérica)" },
{ code: "fr", name: "français" },
{ code: "hr", name: "hrvatski" },
{ code: "it", name: "italiano" },
@satomacoto
satomacoto / setup.sh
Last active October 25, 2018 05:37
Install node and npm with n
# install node & npm
apt-get install -y nodejs npm apt-transport-https
npm cache clean
npm install n -g
n stable
ln -sf /usr/local/bin/node /usr/bin/node
ln -sf /usr/local/bin/npm /usr/bin/npm
import seaborn as sns
colorDict = {}
palette = "hls"
colorPalette = sns.color_palette(palette, len(allLabels))
for i, label in enumerate(allLabels):
colorDict[label] = colorPalette[i]