Skip to content

Instantly share code, notes, and snippets.

View reizist's full-sized avatar
🖖
Working from home

Reiji Kainuma reizist

🖖
Working from home
View GitHub Profile
@reizist
reizist / amazon_asin.py
Created April 21, 2023 01:01
AmazonProductAPIメモ(JAN=>ASINを試みた)
from amazon.paapi import AmazonAPI
import sys
if __name__ == "__main__":
amazon = AmazonAPI("ACCESS_KEY", "SECRET_KEY", "AFF_TAG","JP")
try:
products = amazon.get_items(item_ids=["4971633002005"], item_id_type="EAN")
except Exception as e:
print(e)
@reizist
reizist / extract_bq_to_gcs.py
Created August 26, 2022 09:07
特定のpartitionのみデータコピーをするためにpartitionごとにgcsに吐くマン
from datetime import datetime, timedelta
import subprocess
BUCKET = ""
TABLES = [
{ "dest_table": "project:dataset.table", "start": "2019/03/01", "end": "2019/03/02" },
]
def daterange(_start, _end):
for n in range((_end - _start).days):
@reizist
reizist / ls_s3.py
Last active October 5, 2023 06:33
run aws command on gcp with keyless"
import boto3
import json
import os
from botocore.credentials import Credentials
from google.oauth2 import id_token
from google.oauth2 import service_account
import google.auth
import google.auth.transport.requests
require "logger"
require 'pry-byebug'
require "google/cloud/dlp/v2"
include Google::Cloud::Dlp::V2
ROW_SCAN_LIMIT = 10000
# Doc: https://googleapis.dev/ruby/google-cloud-dlp-v2/latest/Google/Cloud/Dlp/V2.html
client = DlpService::Client.new
require 'pry-byebug'
require 'app_store_connect'
private_key_str = ENV['PRIVATE_KEY']
private_key = private_key_str.gsub('\n', "\n")
AppStoreConnect.config = {
issuer_id: ENV['ISSUER_ID'],
key_id: ENV['KEY_ID'],
private_key: private_key
require "gnuplot"
# require 'gnuplot/multiplot'
require "csv"
require 'pry-byebug'
data = CSV.read('./data.csv', headers: true, return_headers: false)
all_data = []
@reizist
reizist / generate_schema_from_td.rb
Created February 1, 2021 13:15
Output bigquery schema from TD
# TODO:
# 1. gem install td-client
# 2. Set TD_API_KEY, TD_DATABASE
# 3. Prepare table_list.txt including table name list
# 4. Execute like this: ruby generate-schema.rb table_list.txt
require 'td-client'
DB = ENV["TD_DATABASE"]
TYPE_TABLE = {
"boolean" => "BOOLEAN",
require 'aws-sdk-kinesis'
require 'pry-byebug'
class GetRecords
def initialize
@client = Aws::Kinesis::Client.new
end
def stream_name
@reizist
reizist / resize images in dir
Last active June 5, 2019 18:55
zip & unzip
for d in ./*/; do ( cd "$d" && mogrify -resize 'x1200>' *.jpg ) done
@reizist
reizist / 00_timeline.md
Last active September 16, 2018 02:03 — forked from south37/00_timeline.md
ISUCON Cheat Sheet