Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

uzulla / Junichi Ishida uzulla

🏠
Working from home
Block or report user

Report or block uzulla

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@uzulla
uzulla / getenv will not work with phpdotenv.md
Last active Sep 10, 2019
getenv() will not work with `vlucas/phpdotenv` when set "disable_functions=putenv" at php.ini
View getenv will not work with phpdotenv.md

getenv() will not work with vlucas/phpdotenv when set "disable_functions=putenv" at php.ini

php.ini

disable_functions=putenv

you could be check by phpinfo()

@uzulla
uzulla / unzip.php
Created Sep 10, 2019
uploadしてあるzipをサーバーで解凍
View unzip.php
<?php
# uploadしてあるzipをサーバーで解凍
# FTPが重いレンサバなどで、`unzip source.zip`が使えない場合などに使う
# ext-zipが必要
ini_set("max_execution_time", 300);
$zip = new \ZipArchive;
if ($zip->open('source.zip') === true){
$zip->extractTo(__DIR__.'/');
$zip->close();
echo 'success';
@uzulla
uzulla / fb_ogp_cache_hard_reset.html
Created Nov 8, 2016
FacebookのOGPキャッシュがDebuggerでも消えない時に使う。たとえばog:imageがいつまでも出てこないときとか。
View fb_ogp_cache_hard_reset.html
<html>
<body>
FacebookのOGPキャッシュがDebuggerでも消えない時に使う。
<form action="https://graph.facebook.com/" method="post">
url: <input name="id" ><br>
scrape: <input type="text" name="scrape" value="true"><br>
<input type="submit">
</form>
</body>
</html>
View MiddlewareResolver.php
<?php
class MiddlewareResolver
{
public $queue = [];
public function __construct(array $list)
{
$this->queue = $list;
}
View h2o_fastcgi.spawn.md

Config

file.custom-handler:
  extension: .php
  fastcgi.spawn: "PHP_FCGI_CHILDREN=10 exec /root/.phpenv/versions/7.0.0beta3/bin/php-cgi"

pstree

@uzulla
uzulla / bbs.php
Last active Aug 29, 2015
短い掲示板
View bbs.php
<form method="post">
<input name="text">
<input type="submit">
</form>
<?php
!empty($_POST["text"]) && file_put_contents("log.php", date("c>").htmlspecialchars($_POST["text"], ENT_QUOTES, "UTF-8")."\n", FILE_APPEND) && header("location: {$_SERVER['REQUEST_URI']}");
echo @implode('<br>',array_reverse(file("log.php")));
@uzulla
uzulla / delete_old_files.sh
Created Aug 7, 2014
○日前のファイルを消すやつ
View delete_old_files.sh
find /path/to -atime +30 |grep .tmp|xargs rm
@uzulla
uzulla / yen.php
Last active Aug 29, 2015
日本語WindowsできびしそうなPHPコードがこちらです
View yen.php
<?php
namespace ¥\¥{
class ¥{
static public function ¥(){
echo "\\ is not ¥".PHP_EOL;
}
}
}
namespace {
@uzulla
uzulla / wp-config.php
Created Jun 22, 2014
Wordpressでwp-login.phpにBasic認証つけるやつ .htaccessを宗教上の理由でつかえない人や、nginx上でそもそもBasic/Digest認証とか設定するのがnginxのconfigにかかなきゃいけないしだるい。かといってwp-login.phpに直接書くとバージョンアップでもどされちゃう、という人向けです。 注意:あくまで簡易的な自動アタック避けです。
View wp-config.php
<?php
// wp-config.phpの先頭あたりに適当につっこむ
// YOURNAMEとPASSWORDは適当に書き換える
if(preg_match('/wp-login\.php$/', $_SERVER['PHP_SELF'])){
if( !($_SERVER["PHP_AUTH_USER"]=='YOURNAME') || !($_SERVER["PHP_AUTH_PW"]=='PASSWORD') ) {
header('WWW-Authenticate: Basic realm="Please Enter Your Password"');
header("HTTP/1.0 401 Unauthorized");
echo "Authorization Required";
die;
@uzulla
uzulla / want.php
Created Jun 6, 2014
寿司と温泉
View want.php
<?php
$♨ = "温泉";
function 🍣(){
return "おすし";
}
echo "{$♨}いきたいな〜、".🍣()."たべたいなー。".PHP_EOL;
You can’t perform that action at this time.