Skip to content

Instantly share code, notes, and snippets.

@YusukeIwaki
YusukeIwaki / unused_turnip_step_check.rb
Created Jan 24, 2020
Turnipのstepで未使用のものや未定義のものなどを抽出するスクリプト
View unused_turnip_step_check.rb
feature_files = Dir.glob('features/**/*.feature')
step_files = Dir.glob('steps/**/*_steps.rb')
Usage = Struct.new(:feature, :scenario, :step)
StepUsageItem = Struct.new(:step_description, :usages)
require 'turnip'
# 全Featureを読み、それぞれのstepがどのfeature/scenario で使われているかを調べる。
step_usage = {}
@YusukeIwaki
YusukeIwaki / open3_example.rb
Created Dec 19, 2019
2つ以上のIOストリームをマージする
View open3_example.rb
require 'open3'
Open3.popen3("ping", "google.com") do |stdin, stdout, stderr, wait_thr|
stdin.close
while std_ready_list = IO.select([stderr, stdout])&.first
std_ready_list.each do |std|
puts ">> #{std.readline}"
end
end
end
@YusukeIwaki
YusukeIwaki / ggrks.js
Created Nov 20, 2019
ぐぐれかすをpuppeteerでサクッと
View ggrks.js
// yarn init -y
// yarn add puppeteer-core
const puppeteer = require("puppeteer-core");
const launchChrome = puppeteer.launch({
// MacにインストールされているChromeを使う。
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
// ブラウザ画面を表示しながら(ヘッドレスモードを無効にする)。
View Dockerfile
FROM ruby:2.6-alpine
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
RUN bundle init
RUN sed -i -e 's/# gem "rails"/gem "rails"/' Gemfile
# For installing Nokogiri (ref: https://copo.jp/blog/2016/03/alpine-%E3%81%AE-ruby-%E3%81%AE%E3%82%A4%E3%83%A1%E3%83%BC%E3%82%B8%E3%81%AB-nokogiri-%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB/ )
RUN apk add --no-cache build-base libxml2-dev libxslt-dev
View install-golang.sh
wget https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz
rm -rf go/
tar xzvf go1.12.7.linux-amd64.tar.gz
sudo mv go /usr/local/go
sudo touch /etc/profile.d/golang.sh
echo 'export GOROOT=/usr/local/go' | sudo tee --append /etc/profile.d/golang.sh
echo 'export GOPATH=~/' | sudo tee --append /etc/profile.d/golang.sh
echo 'export PATH=$GOROOT/bin:$PATH' | sudo tee --append /etc/profile.d/golang.sh
@YusukeIwaki
YusukeIwaki / japanese_cmd_space.json
Last active Jul 11, 2019 — forked from keik/japanese.json
Karabiner-Elements で command + space での IME トグル
View japanese_cmd_space.json
{
"title": "For Japanese",
"rules": [
{
"description": "toggle eisuu with command + space",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "spacebar",
@YusukeIwaki
YusukeIwaki / docker-compose.yml
Created Mar 12, 2019
Elasticsearch + Kibana
View docker-compose.yml
version: '2.2'
services:
elasticsearch:
image: elasticsearch:5.6
environment:
- discovery.type=single-node
ulimits:
memlock:
soft: -1
hard: -1
@YusukeIwaki
YusukeIwaki / upgrade_ubuntu.sh
Created Feb 17, 2019
Cloud9 proでubuntu 18.04
View upgrade_ubuntu.sh
#!/bin/sh
sudo apt-get update
sudo apt-get -y install update-manager-core
sudo do-release-upgrade
View electron-vue
npm install -g @vue/cli
vue create プロジェクト名
cd プロジェクト名/
vue add electron-builder
yarn electron:serve
View rails_new_options.txt
$ bundle exec rails new -h
Usage:
rails new APP_PATH [options]
Options:
[--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated applications)
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /usr/local/rvm/rubies/ruby-2.5.3/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)