Skip to content

Instantly share code, notes, and snippets.

View sugumura's full-sized avatar
🏠
Working from home

Suguru Murakami sugumura

🏠
Working from home
View GitHub Profile
@sugumura
sugumura / prefectures.json
Last active July 5, 2017 05:24
都道府県。jp_prefecture gemのyamlから変換しています。 https://github.com/chocoby/jp_prefecture/blob/master/data/prefecture.yml
[
{
"code": 1,
"name": "北海道",
"name_e": "hokkaido",
"name_h": "ほっかいどう",
"name_k": "ホッカイドウ",
"area": "北海道"
},
{
@sugumura
sugumura / overwrite_plist.sh
Created October 19, 2017 16:01
for cordova hook scripts
#!/bin/bash
PLIST=platforms/ios/*/*-Info.plist
echo 'exec overwrite_plist.sh'
cat << EOF |
Delete :CFBundleDevelopmentRegion
Add :CFBundleDevelopmentRegion array
Add :CFBundleDevelopmentRegion:0 string "Japanese"
@sugumura
sugumura / snippets.md
Created October 24, 2017 01:29
自分のスニペットコマンドメモにしていくつもり

Server

圧縮

$ tar zcvf log`date +%Y%m%d`.tar.gz ./log

Local Server

@sugumura
sugumura / webapp_healthd.conf
Created March 1, 2018 11:32
nginxでキャッシュ時間を0にしたい場合
########
# ~~~
########
location /public {
alias /var/app/current/public;
gzip_static on;
gzip on;
expires 0;
add_header Cache-Control public;
@sugumura
sugumura / webapp_healthd.conf
Created March 12, 2018 02:48
NginxでSlackbotのアクセスを弾きたい場合
# ref: https://api.slack.com/robots
location / {
if ( $http_user_agent ~* (Slackbot-LinkExpanding) ) {
return 403;
}
}
@sugumura
sugumura / create_rails_app.md
Last active April 27, 2018 10:39
Start Ruby on Rails.
$ mkdir {your_app}
$ bundle init
$ vim Gemfile

# enable rails gem and edit version
gem "rails", '5.2.0'


$ bundle install --path=vendor/bundle --jobs=4
@sugumura
sugumura / command.rb
Created July 19, 2018 06:09
Rails consoleでJSONを出力したいとき
# ファイルに書き出したい
>> f = File.new(Rails.root + 'hoge.json', 'w')
>> f << JSON.pretty_generate(Post.all.as_json)
>> f.close
# 出力したい
>> puts JSON.pretty_generate(Post.all.as_json)
@sugumura
sugumura / app.module.ts
Last active September 5, 2018 08:19
IonicでのFirebaseによるプッシュ通知用のトークンを取得するサンプル。
// src/app/app.module.ts
import { Firebase } from '@ionic-native/firebase';
@NgModule({
//...
providers: [
Firebase,
],
//...
})
export class AppModule {}
@sugumura
sugumura / Gemfile
Last active September 5, 2018 08:23
google/google-auth-library-rubyを利用したFCMへのプッシュ通知サンプル。Ruby on Rails前提
source 'https://rubygems.org'
gem 'rails'
# google/google-auth-library-ruby
gem 'googleauth'
# HTTPリクエストできればなんでもよい
gem 'faraday'
@sugumura
sugumura / remove_any_docker_volume.md
Last active October 9, 2018 07:24
docker volumeをgrepで引っ掛けて削除するやつ。動作の保証はしません
$ docker volume ls | grep [your keyword] | awk '{print $2}' | xargs docker volume rm