Skip to content

Instantly share code, notes, and snippets.

View takahashiyuya's full-sized avatar

Yuya Takahashi takahashiyuya

View GitHub Profile
@takahashiyuya
takahashiyuya / gist:277e8bb37dd25253c157
Created February 8, 2016 04:02
npm install を sudo なしでグローバル実行できるようにする
sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/local/lib/node_modules
@takahashiyuya
takahashiyuya / Laravel
Last active February 16, 2016 06:41
Webサーバとコマンドラインの実行ユーザ異なっていても書き込みできるようにする
APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1`
sudo chmod -R +a "$APACHEUSER allow delete,write,append,file_inherit,directory_inherit" storage
sudo chmod -R +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" storage
@takahashiyuya
takahashiyuya / gist:b6083c213afec3ab5e1a
Created June 2, 2015 06:21
ファイルの改行コードを LF に置換する
find . -type f | xargs -n 10 nkf -Lu --overwrite
@takahashiyuya
takahashiyuya / gist:5dae1e1b90eea3f9346a
Last active August 29, 2015 14:15
Data URI scheme をシェルで生成する。そんで関数にしてコマンドを追加する
・シェル
echo "data:image/png;base64,"$(base64 ファイル名)
・コマンドにする
echo 'function datauri() { echo "data:image/png;base64,"$(base64 $1); }' >> .bash_profile
source .bash_profile
datauri ファイル名
@takahashiyuya
takahashiyuya / gist:4fc55ce7460fe0868d13
Created February 16, 2015 05:57
awk で重複行の削除
awk '!a[$0]++' FILE
@takahashiyuya
takahashiyuya / gist:3404635e1e1521c4f1bd
Created October 7, 2014 03:32
.gitignore.io のURL
https://www.gitignore.io/api/linux,osx,windows,intellij,rubymine,phpstorm,ruby,composer,bower,node,laravel,cakephp,symfony,rails,python,pycharm
@takahashiyuya
takahashiyuya / gist:24ea9b53da079653c1f3
Created June 27, 2014 10:31
自動採番値(要するに次のid)を取得するSQL
SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = "databaseName" AND TABLE_NAME = "tableName";
@takahashiyuya
takahashiyuya / Brewfile
Last active August 1, 2017 06:56
My Brewfile
# Archiver
cask 'the-unarchiver'
# Browser
cask 'google-chrome'
# Client
cask 'sequel-pro'
cask 'tunnelblick'
@takahashiyuya
takahashiyuya / gist:0de8a24811ec45e9b426
Last active August 29, 2015 14:01
PHP プレーンテキストの改行を区切りに正規表現で配列形式っぽく置換する
#検索文字列
^(.*)$
#置換文字列
'$1' => '$1',
[user]
name = Hoge Huga
email = hogehuga@example.com
[color]
ui = auto
[core]
#editor = /usr/bin/vim
editor = /usr/local/bin/vim
quotepath = false
[alias]