Skip to content

Instantly share code, notes, and snippets.

@satomacoto
satomacoto / README.md
Last active April 7, 2024 05:14
Install pyenv and conda

Install pyenv

$ brew update
$ brew install pyenv

Check available versions and install

# 命令書
あなたはシニアソフトウェアエンジニアです。
以下の制約条件と入力文をもとに改善されたコードおよびテストのためのコードを出力してください。
# 制約条件
- コードを変える場合は、その理由を説明する
- [X]を日本語とする
- 適切にGoogle Styleの[X]でdocstringを追加する
@satomacoto
satomacoto / create.py
Last active December 15, 2022 10:34
kNN on xvideos.com-db.csv
# -*- coding:utf-8 -*-
from pymongo import MongoClient
client = MongoClient()
db = client.xvideos
def create_db():
f = open('xvideos.com-db.csv')
for line in f:
@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 / README
Created October 12, 2013 14:44
Flask + MessagePack
https://devcenter.heroku.com/articles/getting-started-with-python
http://flask.pocoo.org/
http://docs.python-requests.org/en/latest/
https://github.com/msgpack/msgpack-python
@satomacoto
satomacoto / parameter_estimation.py
Created February 17, 2012 09:08
Parameter Estimation for Linear Dynamical Systems
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Parameter Estimation for Linear Dynamical Systems
x[t] = A*x[t-1] + w[t]
y[t] = C*x[t] + v[t]
w[t] ~ N(0,Q)
v[t] ~ N(0,R)
'''
@satomacoto
satomacoto / mathjax.html
Created November 29, 2012 06:15
MathJax Dynamic Math Test Page
<!DOCTYPE html>
<!-- http://docs.mathjax.org/en/v1.1-latest/typeset.html -->
<html>
<head>
<meta charset="utf-8">
<title>MathJax Dynamic Math Test Page</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [["$","$"],["\\(","\\)"]]
@satomacoto
satomacoto / logging_sample.ipynb
Created December 18, 2019 01:44
logging for jupyter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@satomacoto
satomacoto / yahoo_keiba.py
Created June 27, 2012 02:59
競馬 - Yahoo!スポーツ
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from subprocess import *
import urllib2,re,math
from BeautifulSoup import BeautifulSoup
def get_races(url,r=10):
@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