This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while;do sleep 3; printf "\r%s" $(date | awk '{print $1 $2 "_" $4 }'); done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SQLite path in Mac. | |
/Users/***/Library/Containers/com.evernote.Evernote/Data/Library/Application\ Support/com.evernote.Evernote/accounts/www.evernote.com/***/localNoteStore/LocalNoteStore.sqlite | |
# SQL | |
SELECT ZLOCALUUID FROM ZENNOTE WHERE ZGUID="foo"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# shell | |
# $ printf '\xF0\x9D\x95\x92' | |
# $ printf "𝕒"| hexdump | |
# f09d9592 𝕀 | |
$start = 4036859264; | |
$end = 4036859281; | |
for ($i=$start; $i<$end; $i++) { | |
$hex = escape(dechex($i)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('Asia/Tokyo'); | |
$date = new DateTimeImmutable(); | |
var_dump($date->format('Y-m-d H:i:s.u')); | |
var_dump($date->format('Y-m-d H:i:s.v')); | |
$date = new DateTimeImmutable('2020-04-20 11:12:13'); | |
var_dump($date->format('U')); | |
var_dump(mktime($hour=11, $minute=12, $second=13, $month=4, $day=20, $year=2020)); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$time = microtime(true); | |
register_shutdown_function( | |
function () use ($time) { | |
$time = microtime(true) - $time; | |
$format = <<<EOD | |
Memory: %s / %s MB | |
Time: %f ms | |
EOD; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--TEST-- | |
mail test | |
--INI-- | |
sendmail_path=./stdout.sh | |
mail.add_x_header=off | |
mail.log=./mail.log | |
--FILE-- | |
<?php | |
# pear run-tests mailtest.phpt | |
$to = 'example@example.com'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = 0.1 + 0.1 + 0.1; | |
$b = 0.3; | |
if ($a != $b) { | |
echo "Round-off error" . PHP_EOL; | |
} | |
$a = (0.1 * 0.1) * 30; | |
$b = 0.3; | |
if ($a != $b) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# php -d register_argc_argv=0 main.php | |
var_dump(ini_get("register_argc_argv")); | |
$argv = [ | |
__FILE__, | |
'-f', | |
'123', | |
]; | |
var_dump(getopt('f:')); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
dir_path="/path/" | |
date_str=$(date "+%Y%m%d_%H%M%S") | |
log_name="${dir_path}/${date_str}.log" | |
touch "${log_name}" | |
command 2>&1 | tee -a ${log_name}; | |
# or | |
command >> "${log_name}" 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ `date +"%Y%m%d"` == "20200401" ]; then | |
# do something | |
: | |
fi |
NewerOlder