Skip to content

Instantly share code, notes, and snippets.

View horitaku1124's full-sized avatar

Horimatsu Takuya horitaku1124

  • Tokyo
View GitHub Profile
@horitaku1124
horitaku1124 / dynamic_call.js
Last active December 19, 2015 21:19
文字から宣言された関数を呼び出す
var Funs = {fun1: function(n){return n + 100;}};
Funs["fun1"](1); // => 101
({fun1: function(n){return n + 100;}})["fun1"](2); // => 102
@horitaku1124
horitaku1124 / git_note.md
Last active December 20, 2015 16:29
git自分まとめ

登録系

コミットした後に小さなミスを修正したい場合に、直前のコミットを取り消す。
$ git reset --soft HEAD^
コミット取り消し
$ git reset HEAD^
@horitaku1124
horitaku1124 / StatementIterator.php
Created August 7, 2013 13:19
PDOのセレクト結果をForeachで回すためのイテレータ
<?php
/**
* PDOのセレクト結果をForeachで回すためのイテレータ
*
* Class StatementIterator
* @package LIBRARY
*/
class StatementIterator implements \Iterator {
/**
@horitaku1124
horitaku1124 / forwarding.sh
Last active December 21, 2015 00:38
SSHポートフォワーディング
#!/bin/bash
#ローカルの8080番ポートにアクセスするとリモートの80番に転送される
#http://localhost:8080/ にアクセスすると http://1.2.3.4:80/ の内容が表示される。
ssh -L 8080:localhost:80 [email protected] -p 22 -i /path/to/id_rsa
@horitaku1124
horitaku1124 / 1.httaccess
Created November 25, 2013 11:12
特定のURIのみIP制限したい
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
RewriteCond %{REMOTE_ADDR} !^5\.6\.7\.8$
RewriteCond %{REQUEST_URI} ^/something.html$ [NC]
RewriteRule ^(.*)$ - [F]
find | grep .zip | xargs -I file cp file ./dist/
unzip \*.zip
@horitaku1124
horitaku1124 / 2.htaccess
Created February 15, 2014 12:43
ダイジェスト認証をする
# htdigest -c /etc/httpd/.htdigest 'Secret Zone' username
AuthType Digest
AuthName "Secret Zone"
AuthUserFile /etc/httpd/.htdigest
Require user username
@horitaku1124
horitaku1124 / curl_usage.md
Last active August 29, 2015 13:57
curlのオプションの指定の仕方

Cookieを保存

$ curl -c cookie URL

Cookieを送信

$ curl -b cookie URL
@horitaku1124
horitaku1124 / linux_commands.md
Created April 4, 2014 07:18
Linuxでのコマンド組み合わせ

ログファイルの最後のN行

find . -name '*.log' | xargs tail -n 4
@horitaku1124
horitaku1124 / daily_copy.sh
Created April 21, 2014 12:24
1日以内に更新された、htmlとcssをコピー
find . -mtime -1 -name "*.html" -o -name "*.css" | xargs -I FILE cp FILE /path/to/FILE