Skip to content

Instantly share code, notes, and snippets.

View appkr's full-sized avatar
🎯
Focusing

appkr appkr

🎯
Focusing
View GitHub Profile
@appkr
appkr / wc.md
Created November 1, 2018 05:32
wc cheatsheet
$ wc -l public/metronic/**/*.css

     -c      The number of bytes in each input file is written to the standard output.  This will cancel out any
             prior usage of the -m option.

     -l      The number of lines in each input file is written to the standard output.

     -m      The number of characters in each input file is written to the standard output.  If the current
 locale does not support multibyte characters, this is equivalent to the -c option. This will cancel
@appkr
appkr / shallow_load.md
Created November 1, 2018 05:14
Laravel Shallow Load
/** @var PointAccount $pointAccountModel */
$pointAccountModel = PointAccount::getModel();
$foreignKey = $pointAccountModel->businessOwner()->getForeignKey();
$localKey = $this->getKeyName();

return new HasOne(
    $pointAccountModel->newQuery()->setEagerLoads([]), 
    $this, 
 "{$pointAccountModel->getTable()}.{$foreignKey}", 
@appkr
appkr / aws.md
Last active November 1, 2018 03:44
AWS CLI cheatsheet

AWS CWLog S3 Download

$ aws --profile <PROFILE> --region ap-northeast-2 s3 cp s3://elasticbeanstalk-ap-northeast-2-510676036070/resources/environments/logs/publish/<EB_ENVIRONMENT_ID>/ . \
--recursive \
--exclude "*" \
--include "*_var_app_current_storage_logs_rotated_laravel.log15215*****" \
--include "*_var_app_current_storage_logs_rotated_laravel.log15216*****"

$ gzip -d ./*/*.gz
@appkr
appkr / netstat.md
Created November 1, 2018 03:10
netstat cheatsheet
$ netstat -an | grep tcp | grep 6379

     -a    With the default display, show the state of all sockets; normally sockets used by server processes are
           not shown. With the routing table display (option -r, as described below), show protocol-cloned routes
           (routes generated by a RTF_PRCLONING parent route); normally these routes are not shown.

     -n    Show network addresses as numbers (normally netstat interprets addresses and attempts to display them
           symbolically).  This option may be used with any of the display formats.
@appkr
appkr / base64.md
Last active May 17, 2019 03:24
Shell Command
$ base64 <<< foo:bar
# Zm9vOmJhcgo=

$ base64 -D <<< Zm9vOmJhcgo=
# foo:bar
@appkr
appkr / confluence.md
Last active November 1, 2018 03:48
JQL Cheatsheet

컨플루언스 심볼 Confluence Wiki Symbol

  • (y) 👍
  • (n) 👎
  • (on) 💡
  • (off) offed 💡
  • (*g) green ⭐
  • (*b) blue ⭐
  • (/) ✅
  • (x) ❌
@appkr
appkr / git.md
Last active November 1, 2018 02:41
Git cheatsheet

로컬 브랜치 이름을 바꾸었을 때, 업스트림 원격 브랜치에 연결하는 방법

$ git branch BRANCH_NAME -u origin/BRANCH_NAME

커밋 쪼개기

$ git rebase -i ^
@appkr
appkr / tinker.md
Created October 31, 2018 01:40
PHP artisan tinker with Korean support
$ touch /tmp/.config/psysh/config.php
$ echo "<?php return [ 'useReadline' => false ];" > /tmp/.config/psysh/config.php
$ php artisan tinker
@appkr
appkr / sleep.md
Created October 31, 2018 01:37
usleep in loop
>>> while (true) { $foo = 'bar'; }
 process %cpu mem mem
 php 97.3 6.0MB 8.2MB
 
>>> while (true) { $foo = 'bar'; usleep(1); }
 php 53.0 6.2MB 8.4MB
@appkr
appkr / xdebug.md
Last active October 31, 2018 01:44
Xdebug와 PHPUnit 실행 속도

결론

  • 테스트를 자주 수행해야 하는 (로컬 컴퓨터에) Xdebug를 설치하면 PHPUnit 실행속도가 느려진다.
  • 디버깅용 코드를 실행시키는 PHP 엔진(Docker 컨테이너의 PHP)에만 설치하는 것이 좋다.

실험결과

구분 PHPUnit with Xdebug PHPUnit without Xdebug
실행시간 4.57 minutes 1.25 minutes