$ git reset --soft HEAD^
$ git reset HEAD^
RewriteEngine on | |
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$ | |
RewriteCond %{REMOTE_ADDR} !^5\.6\.7\.8$ | |
RewriteCond %{REQUEST_URI} ^/something.html$ [NC] | |
RewriteRule ^(.*)$ - [F] |
#!/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 |
<?php | |
/** | |
* PDOのセレクト結果をForeachで回すためのイテレータ | |
* | |
* Class StatementIterator | |
* @package LIBRARY | |
*/ | |
class StatementIterator implements \Iterator { | |
/** |
var Funs = {fun1: function(n){return n + 100;}}; | |
Funs["fun1"](1); // => 101 | |
({fun1: function(n){return n + 100;}})["fun1"](2); // => 102 |
Date.prototype.format = function(str) { | |
var y = this.getFullYear(); | |
var m = this.getMonth() + 1; | |
var d = this.getDate(); | |
m = (m < 10 ? "0" : "") + m; | |
d = (d < 10 ? "0" : "") + d; | |
return str.replace(/Y/g, y).replace(/m/g, m).replace(/d/g, d); | |
}; | |
console.log(new Date().format("Y-m-d")); |
#!/bin/bash | |
WP_ROOT=/var/www | |
WP_SITE=http://wp-local/ | |
MYSQL_LOGIN='-u root -ptest ' | |
MYSQL='mysql '$MYSQL_LOGIN | |
MYSQLDUMP='mysqldump '$MYSQL_LOGIN | |
WP_DB=wp_db | |
MYSQL_WP_USER=wp_user |
#!/bin/bash | |
expect -c " | |
set timeout 10 | |
spawn passwd $1 | |
expect \"新しいパスワード:\" { | |
send \"$2\n\" | |
expect \"新しいパスワードを再入力してください:\" | |
send \"$2\n\" | |
} \"New password:\" { |