Skip to content

Instantly share code, notes, and snippets.

View masutaka's full-sized avatar

Takashi Masuda masutaka

View GitHub Profile
@masutaka
masutaka / rbenv-ruby.md
Last active February 18, 2024 13:32
【決定版】rbenv を使った ruby のインストール

rbenv および Ruby-2.5.0 のクリーンインストール

  1. Homebrew の rbenv や ruby-build をインストールしていたら、もろもろ削除する

    $ brew uninstall --force rbenv ruby-build
    $ rm -rf ~/.rbenv
    
  2. rbenv をインストールする

@masutaka
masutaka / settings.yml
Last active December 14, 2023 11:24
github-nippou settings
format:
subject: '### %{subject}'
line: '* [%{title}](%{url}) %{status}'
dictionary:
status:
merged: '**merged!**'
closed: '**closed!**'
@masutaka
masutaka / init.el
Last active November 14, 2023 09:58
~/.emacs.d/init.el
;; moved to https://github.com/masutaka/dotfiles-public/blob/main/.emacs.d/init.el
@masutaka
masutaka / sample.lkml
Last active September 2, 2022 08:30
[解決] なぜか特定の Measure が Explore に出てこない (Looker 22.14.44)
explore: sample {
join: sample2 {
type: left_outer
relationship: many_to_one
sql_on: ${sample.medium} = ${sample2.medium} ;;
}
}
view: sample {
derived_table: {
@masutaka
masutaka / README.md
Last active July 21, 2022 07:31
Example for managing BigQuery schema which the data source is Google Sheets

1. Create schema.json

See Specifying a schema

nametype は必須。mode のデフォルト値は Nullable

2. Create define.json

$ bq mkdef --noautodetect --source_format=GOOGLE_SHEETS \
@masutaka
masutaka / circle.yml
Created April 16, 2017 10:25
capistrano deployment using CircleCI 2.0
version: 2
jobs:
build:
docker:
- image: ruby:2.3.3-alpine
working_directory: /home/circleci/masutaka.net
steps:
- setup_remote_docker:
# https://circleci.com/docs/2.0/docker-layer-caching/
reusable: true
@masutaka
masutaka / Makefile
Last active February 10, 2022 01:56
mitamae Makefile
EXPIRE_SEC := $(shell expr 24 '*' 60 '*' 60)
KERNEL := $(shell uname | tr '[:upper:]' '[:lower:]')
MITAMAE_BIN_DIR := bin
MITAMAE_REPO := itamae-kitchen/mitamae
MITAMAE := $(MITAMAE_BIN_DIR)/mitamae
MITAMAE_ARCH_BIN := mitamae-x86_64-$(KERNEL)
MITAMAE_LATEST_TAR_BALL_URL := https://github.com/$(MITAMAE_REPO)/releases/latest/download/$(MITAMAE_ARCH_BIN).tar.gz
MITAMAE_LATEST_VERSION := $$(curl -s https://api.github.com/repos/$(MITAMAE_REPO)/releases/latest | jq -r .tag_name)
@masutaka
masutaka / bigquery.sql
Last active November 26, 2021 07:00
The ranking of BigQuery total_bytes_billed on 11/18
select
job_type
, user_email
, referenced_tables.dataset_id
, round(sum(total_bytes_billed) / pow(10, 9), 2) AS total_gb_billed
from
`region-us.INFORMATION_SCHEMA.JOBS_BY_PROJECT`
, UNNEST(referenced_tables) AS referenced_tables
WHERE CAST(creation_time AS DATE) = DATE('2021-11-18')
group by job_type, user_email, referenced_tables.dataset_id
@masutaka
masutaka / init.el
Last active April 29, 2021 22:13
a timer setting for recentf-mode without notifications to minibuffer.
(require 'cl)
(defvar my-recentf-list-prev nil)
(defadvice recentf-save-list
(around no-message activate)
"If `recentf-list' and previous recentf-list are equal,
do nothing. And suppress the output from `message' and
`write-file' to minibuffer."
(unless (equal recentf-list my-recentf-list-prev)

1. Create Dataset

$ bq mk sandbox_masutaka

2. Setup orders Table

$ bq mk --table --schema=./orders.json sandbox_masutaka.orders