Skip to content

Instantly share code, notes, and snippets.

@h-sakano
h-sakano / _form.html.erb
Last active May 24, 2019 08:03
Devise registration
<%
options = {
url: form_url
}
options[:as] = resource_name if defined?(resource_name) && resource_name.present?
%>
<%= form_for(resource, options) do |f| %>
<% if !defined?(password_only) || !password_only %>
<%= f.email_field :email %>
@h-sakano
h-sakano / circleci_config.yml
Created July 21, 2018 05:44
Browser testing with CircleCI 2.0(Selenium)
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:7.10-browsers
@h-sakano
h-sakano / file0.txt
Last active February 22, 2018 01:56
OpenCVとmatplotlib.pyplotの競合について ref: https://qiita.com/h-sakano/items/720a347b8e156e2a6c64
$ pip freeze -l
cycler==0.10.0
matplotlib==2.1.2
numpy==1.13.3
opencv-python==3.3.0.10
pyparsing==2.2.0
python-dateutil==2.6.1
pytz==2018.3
six==1.11.0
@h-sakano
h-sakano / file1.txt
Last active December 17, 2018 02:19
GKEでロードバランサのIPを指定するとき、グローバルに属するIPアドレスリソースは使用できないので注意 ref: https://qiita.com/h-sakano/items/fe0ceed6214004b2e26f
Error creating load balancer (will retry): Failed to create load balancer for service default/eccube: requested ip xxx.xxx.xxx.xxx is neither static nor assigned to LB xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(default/hoge)
<uses-permission android:name="android.permission.CAMERA" />
# 静止画だけでなくムービも取るようなアプリなら以下も追記
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
@h-sakano
h-sakano / enable-affinity.sh
Last active December 28, 2017 07:35
GCPのHTTP(S)ロードバランサでセッションアフィニティを設定する ref: https://qiita.com/h-sakano/items/de23e1d6d4a3e6ce925a
backend_list=(`gcloud compute backend-services list | awk -v ORS=" " '!/NAME/{gsub("\n"," ",$1); print $1 }'`)
for v in "${backend_list[@]}"
do
gcloud compute backend-services update "$v" --session-affinity client_ip --global
done
@h-sakano
h-sakano / apache2.conf
Last active December 23, 2017 09:26
GKEのコンテナ内のディレクトリにGCSバケットをマウントする ref: https://qiita.com/h-sakano/items/f82713347eb192586489
.
.
.
# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
.
.
.
@h-sakano
h-sakano / file0.sh
Last active December 20, 2017 12:08
EC-CUBEでフロント画面テンプレートを追加 ref: https://qiita.com/h-sakano/items/d593f3ba85de92452fec
$ cp -r app/template/default/ app/template/[テンプレートコード]/
$ cp -r src/Eccube/Resource/template/default/* app/template/[テンプレートコード]/
@h-sakano
h-sakano / file0.sh
Last active November 28, 2017 08:57
Google Cloud IoT CoreでMQTTを試す ref: https://qiita.com/h-sakano/items/8a4960595e3359ad9ea4
$ openssl genrsa -out rsa_private.pem 2048
$ openssl rsa -in rsa_private.pem -pubout -out rsa_cert.pem
@h-sakano
h-sakano / file0.sh
Last active November 21, 2017 06:11
ArduinoとRaspberry Pi間をZigBeeで接続する ref: https://qiita.com/h-sakano/items/15e1b269d3ceb03cf499
# ベースのアップデート
$ sudo apt-get update
$ sudo apt-get upgrade -y
$ sudo apt-get dist-upgrade
# 必要なライブラリのインストール
$ sudo pip install xbee