<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by pwpk on Medium]]></title>
        <description><![CDATA[Stories by pwpk on Medium]]></description>
        <link>https://medium.com/@poppwpk?source=rss-78238bf9d664------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8rbVYHcTDSUHBaFd5xvaCQ.png</url>
            <title>Stories by pwpk on Medium</title>
            <link>https://medium.com/@poppwpk?source=rss-78238bf9d664------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 03:38:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@poppwpk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[SSH สำหรับ GitHub (Ubuntu WSL)]]></title>
            <link>https://poppwpk.medium.com/ssh-%E0%B8%AA%E0%B8%B3%E0%B8%AB%E0%B8%A3%E0%B8%B1%E0%B8%9A-github-ubuntu-wsl-f607f8867a8d?source=rss-78238bf9d664------2</link>
            <guid isPermaLink="false">https://medium.com/p/f607f8867a8d</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[ssh-agent]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[pwpk]]></dc:creator>
            <pubDate>Sat, 16 Jul 2022 16:20:10 GMT</pubDate>
            <atom:updated>2023-09-12T09:44:40.255Z</atom:updated>
            <content:encoded><![CDATA[<p>คอนเซปต์ Private key -Public key ก็คือจิ๊กซอว์สองอันที่ถูกสร้างพร้อมกัน ด้วยผู้สร้างคนเดียวกัน ดังนั้นมันจึงต่อกันได้พอดี เราก็จะเตรียมการโดยให้ Private jigsaw key อยู่กับเราเก็บให้ดี หวงแหนแสนรัก .. ส่วน Public jigsaw key ก็จะไปฝากกับอีกคน (ก๊อปข้อความในคีย์ไปให้เขา หรือ อัพโหลดคีย์ไปให้เขา ต้องอย่าลืมนะว่าเราจะให้เขาแค่ Public key เท่านั้น!) ่พอถึงเวลาที่จะติดต่อสื่อสารกัน เราทั้งคู่ก็จะเอาจิ๊กซอว์ทั้งสองมาลองประกอบกันดูถ้าเข้ากันได้ก็สุขสมหวัง เพราะเรานั้นคู่กัน การสื่อสารก็ดำเนินต่อไปได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qeL_KIo-mznXiYDH" /><figcaption>Photo by <a href="https://unsplash.com/@varpap?utm_source=medium&amp;utm_medium=referral">Vardan Papikyan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>สำหรับ GitHub SSH Keys</h3><p>ยกตัวอย่าง Repository ชื่อ helloworld ของผม ซึ่งเป็น Private ครับ</p><p>ถ้าใช้ terminal ด้วยคำสั่ง git clone ง่ายๆ ก็ใช้แบบ ssh key ตามภาพ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*kfF-PQJSwp8FIO_HJBlyPw.png" /></figure><p>แต่ถ้าเราไม่มีคู่กุญแจที่เข้ากันได้ ก็จะไม่สามารถ clone ได้</p><p>จะแจ้งว่า permission denied ตาภาพ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9XJ1i6lHTheHHz6A-bZJcw.png" /></figure><p>ดังนั้นเราจะมาทำให้ clone private repo ของเราเองให้ได้กัน</p><h3>เริ่มด้วยการสร้างคู่ Private Key — Public Key</h3><blockquote>ssh-keygen -t ed25519 -C “your@email.com”</blockquote><p>โปรแกรมก็จะถามว่าใช้ชื่อไฟล์ id_ed25519<br>และอยู่ในไดเร็กทอรี่ .ssh ไหม<br>ก็กด Enter เอาตามนั้นเลย</p><p>โปรแกรมก็จะถามอีกว่าประโยคผ่านคืออะไร ถ้าเราระบุ ตอนเราใช้งานก็จะต้องกรอกทุกครั้งเป็นเรื่องความปลอดภัยที่ดีอยู่นะ <br>แต่ถ้าไม่อยากกรอกทุกครั้ง ก็ไม่ต้องใส่ ก็กด Enter ผ่านไปได้เลย</p><p>ในไดเร็กทอรี่ .ssh เราก็จะได้ 2 ไฟล์คือ</p><p>id_ed25519 เป็น private key<br>id_ed25519.pub เป็น public key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*__SvmXGTA8M5-yc2BjGakQ.png" /></figure><h3>เอา Public Key ไปวางบน GitHub</h3><p>ข้อความของ Public key ก็จะอยู่ในไฟล์ .pub</p><p>ใช้โปรแกรมอะไรก็ได้ cat, nano, vim, notepad, vscode เปิดดูแล้วก๊อปปี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*ss9WXrdhX5U_qPq6fyvNXA.png" /></figure><p>แล้วไปวางบน GitHub ได้เลย เมนู SSH keys / Add new<br>ตั้งชื่อ Title ตามสบาย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*2iEiYohQW_dxv-CBf7K9nQ.png" /></figure><h3>เพิ่ม Auto-launching ssh-agent</h3><p>โดยเพิ่มโค้ดนี้เข้าไปที่ ~/.profile</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/02633bd3b8c0311f91b4cc288ae3ea9b/href">https://medium.com/media/02633bd3b8c0311f91b4cc288ae3ea9b/href</a></iframe><p>หลังจากนี้ Ubuntu จะ add ssh private key ของเราเมื่อเปิด WSL terminal ขึ้นมา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*jW0X6fR576ZZSVoj8wfLGA.png" /></figure><h3>ทดลอง Clone</h3><blockquote>git clone git@github.com:username/repositoryname</blockquote><p>จากเดิมที่เราไม่สามารถ clone private repo ของเราเองได้ ตอนนี้ก็จะ clone ได้แล้ว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kVQ8Qr61wdyewmq7R83Wmg.png" /></figure><p>จบแล้วจ้า ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f607f8867a8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SSH สำหรับ GitHub (PowerShell)]]></title>
            <link>https://poppwpk.medium.com/ssh-%E0%B8%AA%E0%B8%B3%E0%B8%AB%E0%B8%A3%E0%B8%B1%E0%B8%9A-github-powershell-83fada4de225?source=rss-78238bf9d664------2</link>
            <guid isPermaLink="false">https://medium.com/p/83fada4de225</guid>
            <category><![CDATA[private-key]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[public-key]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[pwpk]]></dc:creator>
            <pubDate>Sat, 16 Jul 2022 15:45:24 GMT</pubDate>
            <atom:updated>2023-09-12T09:45:08.835Z</atom:updated>
            <content:encoded><![CDATA[<p>คอนเซปต์ Private key -Public key ก็คือจิ๊กซอว์สองอันที่ถูกสร้างพร้อมกัน ด้วยผู้สร้างคนเดียวกัน ดังนั้นมันจึงต่อกันได้พอดี เราก็จะเตรียมการโดยให้ Private jigsaw key อยู่กับเราเก็บให้ดี หวงแหนแสนรัก .. ส่วน Public jigsaw key ก็จะไปฝากกับอีกคน (ก๊อปข้อความในคีย์ไปให้เขา หรือ อัพโหลดคีย์ไปให้เขา ต้องอย่าลืมนะว่าเราจะให้เขาแค่ Public key เท่านั้น!) ่พอถึงเวลาที่จะติดต่อสื่อสารกัน เราทั้งคู่ก็จะเอาจิ๊กซอว์ทั้งสองมาลองประกอบกันดูถ้าเข้ากันได้ก็สุขสมหวัง เพราะเรานั้นคู่กัน การสื่อสารก็ดำเนินต่อไปได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zkLL469PpW-dw3Ms" /><figcaption>Photo by <a href="https://unsplash.com/@varpap?utm_source=medium&amp;utm_medium=referral">Vardan Papikyan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>สำหรับ GitHub SSH Keys</h3><p>ยกตัวอย่าง Repository ชื่อ helloworld ของผม ซึ่งเป็น Private ครับ</p><p>ถ้าใช้ terminal ด้วยคำสั่ง git clone ง่ายๆ ก็ใช้แบบ ssh key ตามภาพ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*kfF-PQJSwp8FIO_HJBlyPw.png" /></figure><p>แต่ถ้าเราไม่มีคู่กุญแจที่เข้ากันได้ ก็จะไม่สามารถ clone ได้</p><p>จะแจ้งว่า permission denied ตาภาพ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0GJkAAit6TeW2QBUYEfWkA.png" /></figure><p>ดังนั้นเราจะมาทำให้ clone private repo ของเราเองให้ได้กัน</p><h3>เริ่มด้วยการสร้างคู่ Private Key — Public Key</h3><blockquote>ssh-keygen -t ed25519 -C “your@email.com”</blockquote><p>โปรแกรมก็จะถามว่าใช้ชื่อไฟล์ id_ed25519<br>และอยู่ในไดเร็กทอรี่ .ssh ไหม<br>ก็กด Enter เอาตามนั้นเลย</p><p>โปรแกรมก็จะถามอีกว่าประโยคผ่านคืออะไร ถ้าเราระบุ ตอนเราใช้งานก็จะต้องกรอกทุกครั้งเป็นเรื่องความปลอดภัยที่ดีอยู่นะ <br>แต่ถ้าไม่อยากกรอกทุกครั้ง ก็ไม่ต้องใส่ ก็กด Enter ได้เลย</p><p>ในไดเร็กทอรี่ .ssh เราก็จะได้ 2 ไฟล์คือ</p><p>id_ed25519 เป็น private key<br>id_ed25519.pub เป็น public key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jggUfH2PRfnsO556Rqwgpg.png" /></figure><h3>เอา Public Key ไปวางบน GitHub</h3><p>ข้อความของ Public key ก็จะอยู่ในไฟล์ .pub</p><p>ใช้โปรแกรมอะไรก็ได้ cat, nano, vim, notepad, vscode เปิดดูแล้วก๊อปปี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BhT5qDdZmD1PpxLBMo3EUg.png" /></figure><p>แล้วไปวางบน GitHub ได้เลย เมนู SSH keys / Add new<br>ตั้งชื่อ Title ตามสบาย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*yPAI-GZpmwX4WmqqTAWq4Q.png" /></figure><h3>ทดลอง Clone</h3><blockquote>git clone git@github.com:username/repositoryname</blockquote><p>จากเดิมที่เราไม่สามารถ clone private repo ของเราเองได้ ตอนนี้ก็จะ clone ได้แล้ว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MQNKA7c0zNR3_geawzNnGQ.png" /></figure><p>จบแล้วจ้า ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83fada4de225" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oh My Bash! Theme และ Font ที่ผมใช้]]></title>
            <link>https://poppwpk.medium.com/oh-my-bash-theme-%E0%B9%81%E0%B8%A5%E0%B8%B0-font-%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%9C%E0%B8%A1%E0%B9%83%E0%B8%8A%E0%B9%89-6b505e07a032?source=rss-78238bf9d664------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b505e07a032</guid>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[nerd-fonts]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[oh-my-bash]]></category>
            <category><![CDATA[fonts]]></category>
            <dc:creator><![CDATA[pwpk]]></dc:creator>
            <pubDate>Thu, 14 Jul 2022 07:28:24 GMT</pubDate>
            <atom:updated>2022-07-14T07:28:24.936Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*_ksJ1jr_8qILWj26a_lGWg.png" /><figcaption>OSH_THEME=”powerline”</figcaption></figure><h3>ติดตั้ง</h3><p>เนื่องจากผมใช้ Ubuntu บน WSL มันก็จะได้ Bash เป็น default shell</p><p>ดังนั้นโปรแกรมแต่ง shell prompt ก็จะเป็น Oh My Bash! จากลิงค์นี้</p><p><a href="https://github.com/ohmybash">Oh My Bash!</a></p><blockquote>หรือถ้าเป็น Z shell ก็จะใช้ Oh My Zsh เป็นต้น</blockquote><h3>เลือก Theme</h3><p>สำหรับ theme ก็มีหลากหลาย ดูได้ในหน้า <a href="https://github.com/ohmybash/oh-my-bash/wiki/Themes">https://github.com/ohmybash/oh-my-bash/wiki/Themes</a> ชอบอันไหนก็เอาชื่อมาใส่ใน ~/.bashrc</p><blockquote>OSH_THEME=”powerline”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*46DEEmzYdeKrnThCsmzBJw.png" /><figcaption>แน่นอนว่าผมก็ใช้ theme ยอดนิยมอย่าง powerline 😄</figcaption></figure><h3>ลง Font</h3><p>ฟอนต์ที่เหมาะกับงานโค้ดดิ้ง หาได้ที่เวบ <strong>Nerd Fonts</strong> ตามลิงค์ด้านล่างนี้เลย</p><p><a href="https://www.nerdfonts.com/">Nerd Fonts - Iconic font aggregator, glyphs/icons collection, &amp; fonts patcher</a></p><p>สำหรับฟอนต์ยอดนิยม โค้ดดิ้งง่าย ดูสบายตาก็จะประมาณนี้..</p><blockquote>Hack<br>Droidsans<br>BitStream<br>Cousine<br>JetBrains<br>Meslo<br>DejaVuSans<br>SauceCodePro</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*JMcIB2CfmhwDVAtWZ4VWNQ.png" /></figure><p>อย่างเช่นผมจะใช้ Hack Nerd Font ก็ไปเปลี่ยนทั้ง teminal และ vs code เลยดังนั้น</p><h3>windows teminal</h3><blockquote>Profiles / Ubuntu xx / Appearance / Text / Font = Hack NF, 12</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w55J4VIPpDU68iQ_18w1sw.png" /></figure><h3>vs code</h3><blockquote>File / Preferences / Settings / Text Editor / Font / Font Family</blockquote><p>ตรงนี้ต้องพิมพ์เอาเอง ซึ่งของเดิมๆ คือ</p><blockquote>Consolas, ‘Courier New’, monospace</blockquote><p>ก็พิมพ์เพิ่มให้ Hack NF อยู่หน้าสุดจะได้เป็น</p><blockquote>‘Hack NF’, Consolas, ‘Courier New’, monospace</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*4Z9jtitusiMaAqMGE0p68A.png" /></figure><blockquote>vs code ผมถนัด size 14 แต่ใน windows teminal จะชอบ size 12 อืมม ทำไมนะ 😅</blockquote><p>หลังจากกำหนดค่าเรียบร้อยแล้ว ใน tab terminal และ editor ก็จะแสดงผลสวยงามตามที่เราคาดหวังแล้วล่ะ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*-OD-azGNI_pZRA9Y7TLAeQ.png" /></figure><blockquote>จบแล้วจ้า ❤️</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b505e07a032" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[จัดการ Users and Groups ด้วย lusrmgr.exe]]></title>
            <link>https://poppwpk.medium.com/%E0%B8%88%E0%B8%B1%E0%B8%94%E0%B8%81%E0%B8%B2%E0%B8%A3-users-and-groups-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-lusrmgr-exe-bd4f69f59dfe?source=rss-78238bf9d664------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd4f69f59dfe</guid>
            <category><![CDATA[windows-11]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[users-and-groups]]></category>
            <dc:creator><![CDATA[pwpk]]></dc:creator>
            <pubDate>Tue, 12 Jul 2022 15:26:49 GMT</pubDate>
            <atom:updated>2022-07-13T06:33:50.331Z</atom:updated>
            <content:encoded><![CDATA[<p>วันนี้ได้เกิดปัญหา docker ที่ใช้งานใน Windows Account ที่พึ่งสร้างขึ้นมาใหม่ ที่ถึงแม้จะคลิกขวาแล้วเลือก Run as Administrator แต่ก็ยังไม่สามารถสั่ง build หรือ compose ได้ และที่สำคัญคือไม่สามารถใช้ docker command บน wls ได้เลย</p><p>ดังนั้นก็ควรที่จะ Run docker บน Account ปัจจุบัน ด้วยการ Double click ธรรมดา แต่ก็จะติดปัญหาอีก คือ Windows จะแจ้งว่า</p><p><strong>“You must be in the docker-users group”</strong></p><p>ก็แปลว่า Windows Account (user) นี้ไม่ได้อยู่ใน docker-group นั่นเอง</p><p>งั้นก็หา Menu Users Groups ทำนองนั้นสิ! แต่ว่า..เอ๊า Windows11 ไม่มีให้อีก</p><p>พอดีว่าไปเจอ GitHub ที่เขาทำ .exe ไว้ ทำให้เราเข้าไปแก้ไขเรื่องนี้ได้ง่ายๆ ตามลิงค์นี้เลย</p><p><a href="https://github.com/proviq/AccountManagement">GitHub - proviq/AccountManagement: Local User and Group Management application, for all Windows editions</a></p><p>ชื่อไฟล์ lusrmgr.exe</p><p>ของเค้าดีจริงๆ :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zz18MqXtnCRbUpWg_LvK7w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd4f69f59dfe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Django https บน AWS Lightsail ภายใน 1 นาที ด้วย CloudFront]]></title>
            <link>https://poppwpk.medium.com/django-https-%E0%B8%9A%E0%B8%99-aws-lightsail-%E0%B8%A0%E0%B8%B2%E0%B8%A2%E0%B9%83%E0%B8%99-1-%E0%B8%99%E0%B8%B2%E0%B8%97%E0%B8%B5-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-cloudfront-146f271299fb?source=rss-78238bf9d664------2</link>
            <guid isPermaLink="false">https://medium.com/p/146f271299fb</guid>
            <category><![CDATA[cloudfront]]></category>
            <category><![CDATA[cdn]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[aws-lightsail]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[pwpk]]></dc:creator>
            <pubDate>Sun, 10 Jan 2021 17:41:26 GMT</pubDate>
            <atom:updated>2021-04-05T17:52:22.447Z</atom:updated>
            <content:encoded><![CDATA[<p>CloudFront เป็นบริการ CDN ของ Amazon Web Service ที่สามารถเพิ่มให้กับ Instance ของเราได้ภายในไม่กี่คลิก!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*3F4EywsGoNH7h2kyxZoF_A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pSxO1fW8hF2pckHvSx2wWw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9LJt7xbmgvQs-tKUzfeZPA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VcsnecobiMriwvri_r6MXw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7C-5D8d2EJLtPv2waV51eQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rRVZb3BBZiWyit2ZzqeMRA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SN6iW8E3HpdAk68Psud_ww.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UbDSc7mgErY6Fx_vXbG6Rw.jpeg" /></figure><blockquote><strong>Custom Domain ถ้าไม่ใส่ เน้นประหยัดก็เรียกหน้าเวบด้วย CloudFront URL ไปก่อน</strong></blockquote><blockquote>อย่าลืมไปแก้ ALLOWED_HOST ใน Settings.py ด้วยนะ โดยเพิ่ม CloudFront URL เข้าไป</blockquote><pre>...<br>ALLOWED_HOSTS = [&#39;localhost&#39;, &#39;zxc123asd.cloudfront.net&#39;]</pre><blockquote>หลังจากแก้ไฟล์ Settings.py แล้วก็สั่ง restart Apache</blockquote><pre>sudo systemctl restart apache2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aSG4BPKpUyfvZ7HEvO9LNg.jpeg" /></figure><p>จบแล้วจ้า :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=146f271299fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[วิธีการ Deploy Django, Apache, Postgres ขึ้นไป AWS Lightsail]]></title>
            <link>https://poppwpk.medium.com/%E0%B8%A7%E0%B8%B4%E0%B8%98%E0%B8%B5%E0%B8%81%E0%B8%B2%E0%B8%A3-deploy-django-apache-postgres-%E0%B8%82%E0%B8%B6%E0%B9%89%E0%B8%99%E0%B9%84%E0%B8%9B-aws-lightsail-a6a543f8b6f7?source=rss-78238bf9d664------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6a543f8b6f7</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[aws-lightsail]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[apache]]></category>
            <dc:creator><![CDATA[pwpk]]></dc:creator>
            <pubDate>Sat, 09 Jan 2021 19:47:07 GMT</pubDate>
            <atom:updated>2021-04-05T18:29:58.100Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W1SNB5L3jE_qqFPnmlK5Wg.png" /></figure><p>สร้าง VPS ราคาประหยัดบน Amezon Web Service เพื่อลง Django Webapp</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-T6T9TD01RU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-T6T9TD01RU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-T6T9TD01RU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/41574b4675e1e061d1cca14287e8f734/href">https://medium.com/media/41574b4675e1e061d1cca14287e8f734/href</a></iframe><h3>AWS Lightsail</h3><p><a href="https://lightsail.aws.amazon.com/">https://lightsail.aws.amazon.com</a></p><h3>ขั้นตอนและคำสั่ง</h3><p><a href="https://gist.github.com/pawinphakum/e0b3116a63a854c64180a42dc066d069">Django with Postgres, Apache and mod_wsgi in Amazon Lightsail</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e9fefdba878204811882fcfe2d665c5/href">https://medium.com/media/5e9fefdba878204811882fcfe2d665c5/href</a></iframe><pre>python manage.py collectstatic --noinput</pre><pre>สำหรับการ collectstatic อีกครั้ง</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6a543f8b6f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PHP Apache+Mysql+Adminer]]></title>
            <link>https://poppwpk.medium.com/php-apache-mysql-adminer-a2c4af6a1128?source=rss-78238bf9d664------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2c4af6a1128</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[adminer]]></category>
            <category><![CDATA[mysql-server]]></category>
            <category><![CDATA[apache]]></category>
            <dc:creator><![CDATA[pwpk]]></dc:creator>
            <pubDate>Sun, 27 Dec 2020 14:14:46 GMT</pubDate>
            <atom:updated>2020-12-27T14:22:07.356Z</atom:updated>
            <content:encoded><![CDATA[<h4>Only Official Docker Images.</h4><p>Dockerfile และ docker-compose.yml สำหรับงาน php web service ง่ายๆ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*0KROMr8eexVy2xAV-Onylw.jpeg" /></figure><h3>Docker Pull</h3><blockquote>docker pull php:7.4.13-apache</blockquote><blockquote>docker pull mysql</blockquote><blockquote>docker pull adminer</blockquote><h3>Install PHP extensions</h3><p>สร้างไฟล์ Dockerfile เราก็จะได้ custom image ขึ้นมา 1 อัน</p><p>ในตัวอย่างคือติดตั้ง mysqli</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c26ed993ea984bbda4008c1fa34cb54/href">https://medium.com/media/6c26ed993ea984bbda4008c1fa34cb54/href</a></iframe><pre>docker build -t pizza_php</pre><h3>RUN!</h3><p>สร้างไฟล์ docker-compose.yml เพื่อสั่ง run service container จาก images ทั้งหมดในคราวเดียวกัน จะได้ service ทั้งหมดอยู่ใน network เดียวกัน</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c29811432f4386c874371ae6234260e0/href">https://medium.com/media/c29811432f4386c874371ae6234260e0/href</a></iframe><blockquote>run scripts ตอนเริ่ม mysql ได้โดยการ mount volume ไปที่ /docker-entrypoint-initdb.d</blockquote><blockquote>ตรง php apache service เราจะใช้ custom image ชื่อ pizza_php ที่สร้างมาใหม่แทน เพราะว่า official image จะไม่ได้ลง sqli ไว้นั้นเอง</blockquote><pre>docker-compose up -d</pre><blockquote>connection url ใน code php จะใช้ dbserver แทน localhost, 127.0.0.1<br>ตัวอย่าง<br>mysql://root:admin@dbserver:3306/pizza</blockquote><p>จบแล้วจ้า :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2c4af6a1128" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clone Django App จาก Heroku มา Run ที่ Local]]></title>
            <link>https://poppwpk.medium.com/clone-django-app-from-heroku-9bea7c5ce003?source=rss-78238bf9d664------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bea7c5ce003</guid>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[pwpk]]></dc:creator>
            <pubDate>Sat, 26 Dec 2020 17:27:48 GMT</pubDate>
            <atom:updated>2020-12-28T11:08:11.208Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*658sHpPXe2IYUablD8CrSg.jpeg" /></figure><p>เมื่อนานมาแล้วเคยเขียนวิธีการ deploy django app ขึ้นไปบน heroku วันนี้เขียนวิธีการ clone django app ลงมา run ที่ local บ้าง</p><h3>1. สิ่งที่ต้องมี</h3><blockquote>1. Heroku CLI</blockquote><blockquote>2. Python Virtualenv</blockquote><blockquote>3. Docker Engine</blockquote><blockquote>4. Postgres Image</blockquote><h3>2. Clone Django App ลงมา</h3><p>ในที่นี้จะ clone pizza999 ลงมานะ</p><pre>heroku git:clone -a pizza999</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*TpEGWsdkmdgMVeabePFQxA.jpeg" /></figure><h3>3. Backup Database และ Download ลงมา</h3><pre>heroku pg:backups:capture -a pizza999<br>heroku pg:backups:download -a pizza999</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*Y1xeUlongbGHk-UECeXGjg.jpeg" /><figcaption>จะได้ไฟล์ latest.dump</figcaption></figure><h3>4. สร้าง Virtualenv เพื่อลง Python Packages</h3><pre>virtualenv venv<br>source venv/bin/active</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*DBxCrdN-2aG8KaIdWx7caQ.jpeg" /><figcaption>สร้าง Virtualenv แล้ว active จะได้ (venv) นำหน้า shell</figcaption></figure><p>หลังจากนั้นลง Python Packages ตามที่ระบุในไฟล์ requirements.txt</p><pre>pip install -r ./pizza999/requirements.txt</pre><h3>5. สร้างไฟล์ .env เพื่อเป็น Key-Value เช่นเดียวกับที่อยู่ใน Heroku App Config Vars</h3><pre>cd pizza999<br>touch .env<br>nano .env</pre><p>เปิดเวบแล้วเข้าไปดูใน Settings &gt; Config Vars แล้วก๊อปมาวางใน .env</p><p>แต่!!</p><ol><li>DATABASE_URL ไม่จำเป็นต้องเหมือนกับ Production</li><li>เพิ่ม DEBUG=True</li></ol><p>จะได้ประมาณนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*d0Qdg3FIkEc4JLXO1dVJvA.jpeg" /><figcaption>ไฟล์ .env ต้องอยู่ใน level เดียวกับไฟล์ Profile</figcaption></figure><p>ให้จำไว้ว่า Database ที่เราตั้งมี User , Password , DB อะไร</p><p>ในที่นี้ ที่เราตั้งตามใจสำหรับ Local คือ</p><pre>user = root<br>password = admin<br>db = pizzadb</pre><blockquote>สำหรับ DEBUG=True จะเอาไว้ใช้กับ Settings.py ตรงบรรทัด<br>DEBUG = os.environ.get(‘DEBUG’, False)<br>อธิบายว่าได้ว่า ถ้าเจอ Key DEBUG ก็ให้อ่าน Value มา แต่ถ้าไม่เจอก็จะได้ False เป็น default , ซึ่งใน Config Vars เราไม่ได้มีไว้ มันจึงเป็น False สำหรับ Production เสมอ</blockquote><ul><li>**** แก้ไข *****</li><li>settings.py ตรงบรรทัด DEBUG ให้แก้เป็นตามนี้</li></ul><pre>DEBUG = (os.environ.get(&#39;DEBUG&#39;, False) == &#39;True&#39;)</pre><pre>เพราะ os.environ.get จะคืนค่าเป็น String แต่ตัวแปร DEBUG ต้องการค่า boolean ดังนั้นจึงใช้ == &#39;True&#39; เพื่อช่วยดำเนินการ</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*GbmrOTEE0WM0LZL6VMHByg.jpeg" /></figure><h3>6. Run Postgres Docker Container</h3><p>รันจากไฟล์ docker-compose.yml ง่ายดีนะ ไม่ต้องพิมพ์คำสั่งยาวๆ ทุกครั้ง ดังนั้นก็สร้างไฟล์เลย</p><pre>touch docker-compose.yml<br>nano docker-compose.yml</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9c008bbdc1c336bdade0d3612f5eaf1/href">https://medium.com/media/e9c008bbdc1c336bdade0d3612f5eaf1/href</a></iframe><blockquote>****** ต้องให้ user, password, db ให้เหมือนกับในไฟล์ .env ในข้อ 5. *****</blockquote><p>แล้วก็ up เลย!</p><pre>docker-compose up -d</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*AD4RfnB5C6WDsJPmSGvwdA.jpeg" /><figcaption>เช็คด้วย docker ps แล้วจะเห็นว่า status เป็น up time</figcaption></figure><h3>7. ทดสอบการเชื่อมต่อด้วย psql แล้ว import dump</h3><pre>psql -h localhost -U root -p 5432 -d pizzadb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*pcU-0S6jKiAdp5XkceZY8A.png" /></figure><p>ใช้คำสั่งต่างๆ ใน psql shell</p><pre>\l # list dbs<br>\c pizzadb # swith to db<br>\dt # list tables<br>\q # exit</pre><p>\q ออกมาจาก psql shell ก่อน แล้วใช้คำสั่ง import dump file ดังนี้</p><pre>pg_restore --verbose --clean --no-acl --no-owner -h localhost -U root -d pizzadb latest.dump</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*qYdDm5poMQYsnSoWTWcRyA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*NX2K9Cxl5p8BRpGaQ3DHOQ.jpeg" /></figure><h3>8. Locally RUN!!</h3><pre>heroku local web</pre><p>ใช้คำว่า web ตามที่ระบุใน Profile</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*xuKLC5Sd8KvGkMvrNbC0tQ.jpeg" /></figure><p>ถ้าไม่ระบุ port จะได้ http ที่ port 5000</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*npVJJ4jERGqqTP53hwESfA.jpeg" /></figure><p>ได้แล้ว !!!! ไหนลองเข้าหน้า admin ซิ …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*_d7kayZ4kBvaZduBNDknIg.jpeg" /></figure><p>OK! แสดงว่า ทุกอย่าง ผ่านได้ด้วยดี สบายๆ :)</p><blockquote>ปล. ถ้ารูปไม่ขึ้นอาจจะต้อง python manage.py collectstatic</blockquote><pre>ถ้าเป็นการ clone จาก github repo ก็อาจจะเพิ่ม<br>git remote add heroku <a href="https://git.heroku.com/YourAppName.git">https://git.heroku.com/YourAppName.git</a><br>เข้าไปด้วยจะได้ เผื่อว่าอยากจะ deploy ไป heroku ก็จะได้สั่ง<br>git push heroku master ได้นั่นเอง</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bea7c5ce003" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inkscape : Create Text for T2Laser Cutting]]></title>
            <link>https://poppwpk.medium.com/inkscape-create-text-for-t2laser-cutting-9ae2b6db2016?source=rss-78238bf9d664------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ae2b6db2016</guid>
            <category><![CDATA[stickers]]></category>
            <category><![CDATA[t2laser]]></category>
            <category><![CDATA[inkscape]]></category>
            <category><![CDATA[laser-cutting]]></category>
            <category><![CDATA[fonts]]></category>
            <dc:creator><![CDATA[pwpk]]></dc:creator>
            <pubDate>Tue, 08 Dec 2020 15:52:04 GMT</pubDate>
            <atom:updated>2020-12-08T15:52:04.200Z</atom:updated>
            <content:encoded><![CDATA[<h3>Inkscape : Create Text for T2Laser Cutting</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*YtUcFJ2OZHD2TAmzKyGYEg.jpeg" /></figure><h4>ทบทวนพื้นฐาน Inkscape กันนิดนึง</h4><pre>Ctrl+Wheel = Zoom<br>Shift+Wheel = เลื่อนเอกสารซ้ายขวา<br>Middle button = ลากเอกสารไปมาได้<br>กด 3 = Zoom Selection<br>กด 4 = Zoom Drawing</pre><h4>1. พิมพ์แล้วปรับขนาด</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RePkkyQfacvJ356pjkJpuQ.jpeg" /></figure><h4>2. แปลง text ให้เป็น path</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*BZr9LuHecJdOquvHnueKhg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*S-Sm4W_cE8kmzyJcx0ebYQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*--xA6mcfIHILdlgJWpMVgw.jpeg" /></figure><h4>3. ทำเส้นขอบ (Stroke) 0.1มม</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*A36g3aa0kKWxHYL4nhizhQ.jpeg" /><figcaption>เปิดหน้าต่าง Fill and Stroke , Fill เลือก No paint</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*PO5bTQhOOTTs7FQN8R-SNg.jpeg" /><figcaption>ยังอยู่ที่หน้าต่าง Fill and Stroke, Stroke paint เลือก Flat color สีดำ</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*8UxoesGQ88IN_m2UFoM0Xw.jpeg" /><figcaption>กำหนดขนาดเส้น 0.1 มม กด Enter</figcaption></figure><h4>4. Save As .DXF R14</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*IAM2tWYYci4afWOCB98BkA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*1UIR9e8BQbQXl14bd8EMcg.jpeg" /><figcaption>เลือกตามนี้</figcaption></figure><h4>5. T2Laser DXF Options</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*aQfgIFyheGaRfSblWSNyyw.jpeg" /></figure><h4>6. Import DXF File</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*toTPSnG-ssqZZH8MT0qa7Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*lxd9qmUzHo8SoFcGphsDuA.jpeg" /></figure><blockquote>พร้อมแล้วก็สั่งยิงเลย ,จบแล้ว :)</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ae2b6db2016" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub Desktop และ VS Code และ Virtualenv บน Windows Subsystem for Linux [EP2/2]]]></title>
            <link>https://poppwpk.medium.com/github-desktop-%E0%B9%81%E0%B8%A5%E0%B8%B0-vs-code-%E0%B9%81%E0%B8%A5%E0%B8%B0-virtualenv-%E0%B8%9A%E0%B8%99-windows-subsystem-for-linux-ep2-2-5608e8320e8e?source=rss-78238bf9d664------2</link>
            <guid isPermaLink="false">https://medium.com/p/5608e8320e8e</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[virtualenv]]></category>
            <dc:creator><![CDATA[pwpk]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 17:07:56 GMT</pubDate>
            <atom:updated>2020-12-03T17:17:16.535Z</atom:updated>
            <content:encoded><![CDATA[<p>การจัดการเรื่อง python environment เรื่อง package ต่างๆ เวลาทำบน linux นั่นคล่องตัวกว่าบน windows เยอะ ดังนั้นก็มาเล่นบน WSL กันดีกว่า แต่เวลา coding อยากจะใช้ vs code ละทำยังไง ? แล้วเรื่อง version control อยากจะใช้ github ละทำยังไง ? … ตามขั้นตอนนี้ได้เลย</p><h3>EP2/2 : WSL+Virtualenv+Python Interpreter และใช้งาน VS Code บน Windows</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*_MuoByqa1H8wXHDPaI9zeA.jpeg" /></figure><h3>1. เปิด WSL แล้วติดตั้ง Virtualenv</h3><pre>$ pip install virtualenv</pre><p>ถ้า pip ไม่ติด ก็ใช้ pip3 แทน</p><h3>2. สร้าง environment สักตัวนึง</h3><pre>$ virtualenv _fox_star</pre><p>ส่วนตัวคือ ชอบใช้ชื่อ env ที่ขึ้นต้นด้วย _ (under score) เพื่อมองแล้วแยกแยะได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*cevBEX5erOquSDzb-Mds1g.jpeg" /></figure><h3>3. ใช้งาน environment</h3><pre>$ source _fox_star/bin/activate</pre><p>เมื่อ activate แล้วจะได้ (env_name) อยู่หน้าสุด</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*9MzuQREtav1OZcCBeP7YCg.jpeg" /></figure><p>ตอนนี้อยู่ใน env _fox_star แล้ว เราก็ pip install package ต่างๆ ได้ตามต้องการเลย ซึ่งจะเป็นการ isolated กับ env อื่นๆ นั่นเอง</p><p>ถ้าต้องไม่ต้องการใช้ env แล้ว ก็ใช้คำสั่ง</p><pre>$ deactivate</pre><h3>4. เอา python environment ที่กำลัง activate ไปใช้ใน VS Code bash terminal</h3><p>เข้าไปใน git repository ก่อน</p><pre>$ cd fox<br>$ code .</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*ScrR8pu_pIkBhpP-ee4JUw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*nR47wYffIjh6EYeJCW66Og.jpeg" /></figure><blockquote>เมื่อเข้ามาอยู่ใน VS Code ที่มี bash และเป็น Python environment ตามที่ activate มาแล้ว … เราสามารถปิดหน้าต่าง WSL ไปเลยก็ได้</blockquote><p>หรือจะลองคลิ๊กที่ Python Interpreter ที่ขอบล่างก็ได้ จะเห็นว่าตอนนี้เรากำลังใช้งาน interpreter ตัวไหน ในรูปจะเห็นได้ว่ากำลังใช้ _fox_star อยู่ .. สามารถเปลี่ยนได้ หรือ กด escape ออกจากการเลือก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*ju4rgcHtmJ_XWoYnekea3A.jpeg" /></figure><p>จบแล้ว 2EP ที่ทำให้ ใช้ git และ virtualenv จาก WSL มาทำงานต่อบน VS Code ได้จบในแอปเดียว :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5608e8320e8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>