Skip to content

Instantly share code, notes, and snippets.

View moriya9n's full-sized avatar

Seiji MORIYA moriya9n

View GitHub Profile
@moriya9n
moriya9n / gist:22daf53cae550fa91e365e1acd4d7f8a
Last active October 3, 2018 02:05
さくらのレンタルサーバーに python3.6 をインストール
さくらのレンタルサーバーに python3.6 をインストールする方法
===================================================
そのままコンパイルすると pip が使えない(SSLバージョンエラー?)ので、openssl を入れる。
openssl のコンパイル
----------------------------------
wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz
tar xvf openssl-1.0.2o.tar.gz
cd openssl-1.0.2o
@moriya9n
moriya9n / gist:0137b88391896e939128859aad601bd6
Last active October 9, 2019 09:38
さくらのレンタルサーバで django / python 3.6 を動かす (速度は期待できないかも)
1. [python 3.6 をインストール](https://gist.github.com/moriya9n/22daf53cae550fa91e365e1acd4d7f8a)する。 venv で仮想環境を作っておく。
2. pip install django
3. django-admin startproject hogehoge
4. レンタルサーバの仕様上、cgi でしか動作しないので、 django-cgi(https://github.com/chibiegg/django-cgi/blob/master/django-python3.cgi)
を取ってくる。(速度は期待できない)
5. cgi の先頭の python パス名は変更。sys.path.append でプロジェクトディレクトリを追加。
6. index.cgi などにリネームして、好きなところに配置。
7. /home/your_account/static などを作って、settings.py に STATIC_ROOT = '/home/your_account/static' を追加。python manage.py collectstatic
を実行。
8. ln -s /home/your_account/static /home/your_account/www/site_name/static
@moriya9n
moriya9n / gist:3b618810b4b499dc17c8f4020ea30c67
Created November 22, 2021 19:18
Amazon paapi を golang で直接呼び出す時の signature 生成方法
// reqJson に json.Marshal したものが入っているとする
// APIHost = "webservices.amazon.co.jp"
// APIRegion = "us-west-2"
// APITarget = "com.amazon.paapi5.v1.ProductAdvertisingAPIv1.SearchItems"
// APIService = "ProductAdvertisingAPI"
bodyReader := bytes.NewReader(reqJson)
req, err := http.NewRequest("POST", "https://" + APIHost + "/paapi5/searchitems", bodyReader)
log.Println("request:", req)