Skip to content

Instantly share code, notes, and snippets.

ruhenheim ruhenheim

  • Kumamoto
View GitHub Profile
View kikuyo_budget.csv
date bucket count
2012-07-20 800 119
2012-07-20 900 123
2012-07-20 1000 173
2012-07-20 1100 226
2012-07-20 1200 284
2012-07-20 1300 257
2012-07-20 1400 268
2012-07-20 1500 244
@ruhenheim
ruhenheim / vmimport_vpc.bat
Created Apr 11, 2013
execute AWS VM Import sample DOS batch for VPC.
View vmimport_vpc.bat
set JAVA_HOME=<JAVA_JRE_HOME>
set EC2_HOME=<EC2_API_TOOLS_HOME>
set EC2_URL=https://ec2.ap-northeast-1.amazonaws.com
REM ## if use Proxy ##
REM set EC2_JVM_ARGS=-Dhttp.proxySet=true -Dhttps.proxySet=true -Dhttp.proxyHost=<YOUR_PROXY_HOST_FOR_HTTP> -Dhttp.proxyPort=<HTTP_PROXY_PORT> -Dhttps.proxyHost=<YOUR_PROXY_HOST_FOR_HTTPS> -Dhttps.proxyPort=<HTTPS_PROXY_PORT>
set PATH=%PATH%;%EC2_HOME%\bin
set AWS_ACCESS_KEY=<YOUR_ACCESS_KEY>
set AWS_SECRET_KEY=<YOUR_SECRET_KEY>
set VMDK=<YOUR-VMDK-FILENAME>.vmdk
set S3_OWNER_ACCESS_KEY=<YOUR_S3_BUCKET_ACCESS_KEY>
View campaigns.xml
<?xml version="1.0" encoding="UTF-8"?>
<VAST version="2.0">
<Ad>
<InLine>
<Creatives>
<Creative>
<Linear>
<Duration>00:00:15</Duration>
<MediaFiles>
<MediaFile delivery="progressive" type="video/mp4">
@ruhenheim
ruhenheim / patch.20171012.diff
Created Oct 12, 2017
お気に入り動作が複数投稿があっても正常動作するまでに修正したパッチ
View patch.20171012.diff
diff --git app/controllers/goods_controller.rb app/controllers/goods_controller.rb
index 119862d..e4826ad 100644
--- app/controllers/goods_controller.rb
+++ app/controllers/goods_controller.rb
@@ -1,15 +1,12 @@
class GoodsController < ApplicationController
def create
- micropost = current_user.microposts.find_by(params[:content])
- good = current_user.goods.find_or_create_by(micropost_id: micropost.id)
- good.save
View rails_template_5.2
## https://techracho.bpsinc.jp/hachi8833/2017_02_16/32827
gem 'slim-rails'
gem 'seed-fu'
gem "aws-sdk-s3", require: false
gem 'image_processing'
gem 'ransack'
# gem 'bcrypt', '~> 3.1.7'
gem_group :development, :test do
gem 'rspec-rails', '~> 3.6.0'
View AWS Cloud9 MySQLバージョン5.5から5.7へのアップグレード手順.md

以下のコマンド操作を順に実施します。

1. 現状のMySQLバージョンを確認

$ mysql --version

2. 旧バージョン(5.5)パッケージ関連を削除

$ sudo yum -y remove mysql-config mysql55-server mysql55-libs mysql55
View check_mysql_socket.rb
def mysql_socket
@mysql_socket ||= [
"/tmp/mysql.sock", # default
"/var/run/mysqld/mysqld.sock", # debian/gentoo
"/var/tmp/mysql.sock", # freebsd
"/var/lib/mysql/mysql.sock", # fedora
"/opt/local/lib/mysql/mysql.sock", # fedora
"/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql
"/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
"/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5
@ruhenheim
ruhenheim / routes.rb
Last active Jun 19, 2019
Railsルーティング定義アレコレ
View routes.rb
Rails.application.routes.draw do
scope '(:locale)', locale: /#{I18n.available_locales.map(&:to_s).join('|')}/ do
# ====================================
# For API
# ====================================
namespace :api do
namespace :v1 do
resources :companies, path: 'cm/', only: [] do
resources :provinces, only: :index, defaults: { format: 'json' }
end
@ruhenheim
ruhenheim / terraform_getting_started.md
Last active Jun 21, 2019
terraform 0.12 を使って はじめる ~ AWS Infrastructure as a Code
View terraform_getting_started.md

Terraform

Getting Started - AWS [using v0.12 or above]

terraform バイナリコマンドファイルをダウンロードし、PATHに追加

$ wget https://releases.hashicorp.com/terraform/0.12.2/terraform_0.12.2_linux_amd64.zip
$ unzip terraform_0.12.2_linux_amd64.zip
$ mkdir -p ~/.local/bin
@ruhenheim
ruhenheim / explain_gsub_method.md
Created Jun 21, 2019
[Ruby]String#gsubメソッドについて
View explain_gsub_method.md

ヒアドキュメント表現

str = <<EOS
問い合わせの内容です。

改行もされています。
HTMLとしては改行コードを<br>要素などに置き換えて表現しないと期待する表示になりません。
EOS
You can’t perform that action at this time.