Skip to content

Instantly share code, notes, and snippets.

@yuzutas0
yuzutas0 / idea-to-gitignore.sh
Created April 18, 2021 01:35
.gitignoreを使わずにIntelliJ IDEAでファイルを編集する
$ ls -la
# => .git
$ echo .idea >> .git/info/exclude
$ less .git/info/exclude
# => .idea
@yuzutas0
yuzutas0 / kyash.md
Last active September 16, 2020 06:21
Kyashの残高を使い切るための手順

【経緯】

  • 最近全く使っていなかったので、全額を引き出す。
  • と言いたいところだが、引き出すには口座確認が必要なので、もっと簡単な方法を採用する。

【概要】

【手順】

@yuzutas0
yuzutas0 / bigquery_tables_access1.sql
Last active August 4, 2022 02:13
https://speakerdeck.com/yuzutas0/20190905?slide=30 のサンプルSQLです。BigQueryのどのテーブルがどのくらい参照されているかUU・PVを計算するクエリです。
WITH
tables AS (
SELECT
table_id
FROM
`{project_id}.{dataset_name}`.__TABLES__
WHERE
table_id NOT LIKE 'LOAD_TEMP_%'
AND table_id NOT LIKE 'TMP_%'
),
@yuzutas0
yuzutas0 / geolonia_schema.json
Last active February 14, 2024 05:14
Geolonia 住所データ https://geolonia.github.io/japanese-addresses/ のCSVファイルをBigQueryに登録するとカラム名取得に失敗するので、スキーマファイルを用意しよう委員会
[
{
"name": "prefecture_code",
"type": "INTEGER",
"mode": "NULLABLE",
"description": "都道府県コード"
},
{
"name": "prefecture_name",
"type": "STRING",
@yuzutas0
yuzutas0 / 2020-03-05-requirement.md
Last active March 5, 2020 05:24
[2020-03-05] 【募集】新規事業のプロトタイプ画面実装

フロントエンドの副業案件です! 土日でガーッと作って15万円を稼ごう!

目的

  • 新規事業のユーザーインタビュー用のプロトタイプを作る
    • 画面上で検索や絞り込みを行いたいので、デザインツールではなくフロント実装を依頼したい

案件概要

@yuzutas0
yuzutas0 / mysql_dump_tsv_to_bigquery_by_dataflow.py
Created June 22, 2019 05:19
ETL Logic: MySQL TSV Dump -> BigQuery by Python3.5 Dataflow
import re
magic_word = '{{{{{converted_by_yuzutas0_dataflow}}}}}'
text = text.replace('\\\"', '\"\"').replace('\\\\', magic_word) \
.replace('\\\"', '\\').replace(magic_word, '\\\\')
text = re.sub(r'\\$', '', text, flags=re.MULTILINE)
if text.startswith('""') and not text.startswith('"""'):
text = text[1:]
@yuzutas0
yuzutas0 / cloud-composer-broken-dag-error-log.sh
Created June 11, 2019 08:43
Cloud Composer: Broken DAG のエラーログを見るコマンド
$ gcloud composer environments run ${instance_name} --location="${location}" list_dags
@yuzutas0
yuzutas0 / big_csv_print_debug.rb
Last active May 28, 2019 07:49
BQへのデータロードが失敗したからCSVファイルの該当レコードを読もうとするが、ファイルが巨大すぎてiTermが落ちたときに私は思ったんだ。該当レコードとその前後だけを抽出するスクリプトがあると便利じゃないか? ーー そう、それがすべての始まり。だからこそ、今ここにいる。僕の言葉ではない、これは僕達の言葉。 ーー 完。
# ruby big_csv_print_debug.rb input_file=test.csv output_file=result.csv line_number=10
arg = {}
ARGV.each do |s|
k, v = s.split('=')
arg[k] = v
end
p arg
target_lines = []
@yuzutas0
yuzutas0 / slideshare.sh
Last active April 29, 2019 15:47
SlideShareで日本語スライドを表示する
$ cp {pdf_file} {pdf_file_copied}
$ LANG=C LC_ALL=C sed -i '' s'|/Registry (Adobe) /Ordering (Japan1) /Supplement [0-9]|/Registry(Adobe) /Ordering(Identity) /Supplement 0|g' {pdf_file}
@yuzutas0
yuzutas0 / google_form_to_slack_by_gas.md
Created April 29, 2019 10:49
GoogleFrom to Slack by GAS

1. set incoming-webhook at slack

  • click channel name
  • Add an app
  • incomming-webhook
  • add configration
  • set target channel and bot name
  • get url

2. add gas