自由學習的風

幽夢影 張潮 少年讀書,如隙中窺月;中年讀書,如庭中望月;老年讀書,如臺上玩月。皆以閱歷之淺深,為所得之淺深耳。

20181020夢 N 臺北場

2018年10月20日 星期六

閱讀理解取經

新北尋寶奇謀

2018年10月19日 星期五

systemd 和 upstart 啟用和停用

2018年8月13日 星期一

參考: https://askubuntu.com/questions/19320/how-to-enable-or-disable-services
-----------------------------------------------------------------------------------------------------------------------

Temporary enabling/disabling services

To stop and start services temporarily (Does not enable / disable them for future boots), you can type service SERVICE_NAME. For example:
  • sudo service apache2 stop (Will STOP the Apache service until Reboot or until you start it again).
  • sudo service apache2 start (Will START the Apache service assuming it was stopped before.).
  • service apache2 status (Will tell you the STATUS of the service, if it is either enabled/running of disabled/NOT running.).
  • sudo service apache2 restart (Will RESTART the service. This is most commonly used when you have changed, a config file. In this case, if you changed either a PHP configuration or an Apache configuration. Restart will save you from having to stop/start with 2 command lines)
  • service apache2 (In this case, since you did not mention the ACTION to execute for the service, it will show you all options available for that specific service.) This aspect varies depending on the service, for example, with MySQL it would only mention that it is missing a parameter. For other services like networking service it would mention the small list of all options available.

SYSTEMD

Starting with Ubuntu 15.04, Upstart will be deprecated in favor of Systemd. With Systemd to manage the services we can do the following:
systemctl start SERVICE - Use it to start a service. Does not persist after reboot
systemctl stop SERVICE - Use it to stop a service. Does not persist after reboot
systemctl restart SERVICE - Use it to restart a service
systemctl reload SERVICE - If the service supports it, it will reload the config files related to it without interrupting any process that is using the service.
systemctl status SERVICE - Shows the status of a service. Tells whether a service is currently running.
systemctl enable SERVICE - Turns the service on, on the next reboot or on the next start event. It persists after reboot.
systemctl disable SERVICE - Turns the service off on the next reboot or on the next stop event. It persists after reboot.
systemctl is-enabled SERVICE - Check if a service is currently configured to start or not on the next reboot.
systemctl is-active SERVICE - Check if a service is currently active.
systemctl show SERVICE - Show all the information about the service.
sudo systemctl mask SERVICE - Completely disable a service by linking it to /dev/null; you cannot start the service manually or enable the service.
sudo systemctl unmask SERVICE - Removes the link to /dev/null and restores the ability to enable and or manually start the service.

UPSTART (Deprecated Since 15.04)

If we want to use the official Upstart way (Note that, for the moment, not all services have been converted to Upstart), we could use the following commands:
status SERVICE - This will tell us if a converted service is running or not. Note that this is deprecated in favor of startstopstatus & restart. It will also tell us if a service has not yet been converted to upstart:
A converted service would typically output the current status (Starting, Running, Stopping...) and process ID. A non converted service would give an error about an unknown job.
Some shortcuts may only work with the service command above but not with the commands below unless they are 100% converted to upstart services:
  • START - sudo start mysql
  • STOP - sudo stop mysql
  • RESTART - sudo restart mysql
  • STATUS - sudo status smbd

Enabling / Disabling a service

To toggle a service from starting or stopping permanently you would need to:
echo manual | sudo tee /etc/init/SERVICE.override
where the stanza manual will stop Upstart from automatically loading the service on next boot. Any service with the .override ending will take precedence over the original service file. You will only be able to start the service manually afterwards. If you do not want this then simply delete the .override. For example:
echo manual | sudo tee /etc/init/mysql.override
Will put the MySQL service into manual mode. If you do not want this, afterwards you can simply do
sudo rm /etc/init/mysql.override
and Reboot for the service to start automatically again. Of course to enable a service, the most common way is by installing it. If you install Apache, Nginx, MySQL or others, they automatically start upon finishing installation and will start every time the computer boots. Disabling, as mentioned above, will make use of the service manual.

[Windows] 設定系統分頁檔

顯示目前分頁檔設定

wmic pagefile
wmic pagefile list /format:list 

設定固定分頁檔大小

wmic computersystem where name="%computername%" set AutomaticManagedPagefile=False
wmic pagefileset where name="C:\\pagefile.sys" set InitialSize=2048,MaximumSize=2048

設定分頁檔後,檢查的方式

wmic pagefileset 
wmic pagefileset list /format:list

[轉貼] EUD Security Guidance: Ubuntu 18.04 LTS

2018年8月9日 星期四

National Cyber Security Centre

原文網址:https://www.ncsc.gov.uk/guidance/eud-security-guidance-ubuntu-1804-lts

轉:[教學文章] phpExcel常用方法詳解

2018年6月5日 星期二

參考網址:EMAN1214

操作excel

1.header
        header("Content-Type:application/vnd.ms-excel");
        header("Content-Disposition:attachment;filename=product.xls");
        header("Pragma:no-cache");
        header("Expires:0");

2.PHPExcel
        http://www.codeplex.com/PHPExcel
        http://www.phpexcel.net
        開發包Tests目錄有詳細使用實例
        支持中文,注意文件編碼,文件保存為utf-8
        寫excel
詳情參閱相關文件內容。

常用的 VSCode 套件(Alex宅幹嘛)

2018年6月1日 星期五

直接看直播影片教學 =>[ Alex 宅幹嘛 ] 👨‍💻開掛囉!!! VSCode 工作學習效率加倍術

  • ESLint
  • Git History
  • gitflow
  • gitignore
  • GitLess
  • indent-rainbow
  • Live Sass Compiler
  • Live Server
  • Markdonw Preview Github Styling
  • Node Exec
  • Path Intellisense
  • Prettier - Code formatter
  • Prettify JSON
  • Project Manager
  • SCSS Intellisense
  • SCSS Refactoring
  • Vetur
  • VS Live Share
  • vscode-icons