NCNU-OpenSource
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- hackpadID: B8CalmI9bbu hackpadWorkspace: ncnu-opensource tags: hackpad-import, ncnu-opensource --- # Week 11 Raspberry pi 2015/05/21 * 去年的LSA - Raspberry pi ssl 線教學: [](https://ncnu-ossg.etherpad.mozilla.org/1?)https://ncnu-ossg.etherpad.mozilla.org/1? [](https://www.raspberrypi.org/documentation/installation/installing-images/linux.md)https://www.raspberrypi.org/documentation/installation/installing-images/linux.md **OS** * 下載 Raspbian OS 映像檔 [](http://downloads.raspberrypi.org/raspbian_latest)http://downloads.raspberrypi.org/raspbian_latest * 確定 SD 卡掛載位置 * df: Display free disk space * diskutil list: List disks * 卸載 SD 卡 * sudo diskutil unmountDisk /dev/disk[N]  * 將映像檔燒入 SD 卡 * sudo dd if=[IMG file location] of=/dev/disk[N] bs=4M * 若出現 **dd: bs: illegal numeric value**,請將 bs 值改為小寫。 ex: bs=4m **使用 TTL 線連上 pi 以操控** 1. 箭頭靠外,插入。 ![](https://hackpad-attachments.s3.amazonaws.com/ncnu-opensource.hackpad.com_B8CalmI9bbu_p.350539_1432174100140_thumb_IMG_4875_1024.jpg) 2\. TTY 線 USB 端接上電腦 * Ubuntu: * sudo screen /dev/ttyUSB0 115200 * OS X:  * screen /dev/cu.usbserial 115200 * Driver: [](http://www.prolific.com.tw/US/ShowProduct.aspx?pcid=41&showlevel=0041-0041)http://www.prolific.com.tw/US/ShowProduct.aspx?pcid=41&showlevel=0041-0041 3\. 連上後,插上 pi 的電源、登入 * username: pi * password: raspberry 登入Pi 後 sudo raspi-config  ((有關系統的設定)) 4\. 插上網路線,更新套件來源 * sudo apt-get update 5.  安裝後置式運算程式、vim、SSH * sudo apt-get install postfix vim openssh-server 6\. 寄信 * sendmail -t [主旨] foo@bar.com * -t 主旨無效耶 * 輸入完內文後,兩次 Contronl + d 以結束寄出 7\. 取得 pi 的 IP 後,即可在自己的電腦用 SSH 遠端登入 * ifconfig | grep inet | awk ’{print $2}’ 8\. 自動寄信 shell * 新增一檔案 sendip.sh 於 ~ 目錄 [](http://reader.roodo.com/rocksaying/archives/19886844.html)http://reader.roodo.com/rocksaying/archives/19886844.html [](https://wiki.debian.org/LSBInitScripts)https://wiki.debian.org/LSBInitScripts * #!/bin/sh * ### BEGIN INIT INFO * # Provides:           sendip * # Required-Start:     $all * # Required-Stop:     * # Default-Start:      2 3 4 5 * # Default-Stop:      * # Short-Description:  Run /etc/sendip if it exist * ### END INIT INFO * echo "Subject: [yourname]@rpi says" > /home/pi/rpiip.mail * echo "From: Me<3 " >> /home/pi/rpiip.mail * echo "To: [youremail add]" >> /home/pi/rpiip.mail * ifconfig | grep inet | awk ’{print $2}’ >> /home/pi/rpiip.mail * /usr/sbin/sendmail -t -f [foo@bar.com] -v -i < /home/pi/rpiip.mail * 更改檔案權限 * sudo chmod 755 sendip.sh * 複製檔案到 /etc/init.d * sudo cp sendip.sh /etc/init.d * 沒錯的話是更新吧親 * sudo update-rc.d sendip.sh defaults * pi 重開機試試吧親 * sudo reboot [](http://raspberrypihq.com/how-to-add-wifi-to-the-raspberry-pi/)http://raspberrypihq.com/how-to-add-wifi-to-the-raspberry-pi/ [](http://www.howtogeek.com/167425/how-to-setup-wi-fi-on-your-raspberry-pi-via-the-command-line/)http://www.howtogeek.com/167425/how-to-setup-wi-fi-on-your-raspberry-pi-via-the-command-line/ apt-get install mailutils * #!/bin/sh * ### BEGIN INIT INFO * # Provides:             email_ip_address * # Required-Start:       $all * # Required-Stop: * # Default-Start:        2 3 4 5 * # Default-Stop: * ### END INIT INFO * ifconfig | awk ’/inet addr/ { sub(/addr:/, "", $2); if ($2 != "127.0.0.1") print $2}’ | mail -s "Raspberry Pi IP address" **_<u>email_address</u>_** [](http://elinux.org/RPi_raspi-config#expand_rootfs_-_Expand_root_partition_to_fill_SD_card)http://elinux.org/RPi_raspi-config#expand_rootfs_-_Expand_root_partition_to_fill_SD_card week13 [](https://github.com/prasmussen/gdrive)https://github.com/prasmussen/gdrive 複製[drive-linux-rpi v1.8.0](https://drive.google.com/uc?id=0B3X9GlR6EmbnRDJ1Z2Y4UWpWU00)的網址 在pi上使用wget下載剛剛的網址 wget ’複製網址’ 將下載的檔案更名方便執行 mv ’下載檔案檔名’ drive 更改檔案權限為775 sudo chmod 775 drive 執行檔案可以查看指令 ./drive 把 drive 移動到 /usr/local/bin 就可以直接以 drive 下指令的方式執行 拿不到 ip 的可以試試看這個方式: * ~$ sudo vim /etc/rc.local find the following line: * printf "My IP address is %s\n" "$_IP" add this line below it * printf "My IP address is %s\n" "$_IP" | sendmail {{mail_address}} ip問題是不是買個這個就解決了(? [](http://goods.ruten.com.tw/item/show?21443540660386)http://goods.ruten.com.tw/item/show?21443540660386 若raspberry pi無法連線 sudo nano /etc/network/interfaces (把內容修改成) auto lo * iface lo inet loopback * auto eth0 * allow-hotplug eth0 * iface eth0 inet dhcp * auto wlan0 * allow-hotplug wlan0 * iface wlan0 inet dhcp * wireless-essid NCNU * wireless-mode managed * iface default inet dhcp 重新啟動: sudo /etc/init.d/networking resta

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully