<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Azka</title>
    <description>The latest articles on DEV Community by Azka (@azukacchi).</description>
    <link>https://dev.to/azukacchi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F453092%2Fb6258c11-4b5d-4d9e-8e0d-b34d912bf31b.png</url>
      <title>DEV Community: Azka</title>
      <link>https://dev.to/azukacchi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/azukacchi"/>
    <language>en</language>
    <item>
      <title>Setting Up Github Pages using Jupyter Book</title>
      <dc:creator>Azka</dc:creator>
      <pubDate>Tue, 08 Mar 2022 11:16:37 +0000</pubDate>
      <link>https://dev.to/azukacchi/setting-up-github-pages-using-jupyter-book-4k77</link>
      <guid>https://dev.to/azukacchi/setting-up-github-pages-using-jupyter-book-4k77</guid>
      <description>&lt;p&gt;(This tutorial is cross-posted on my &lt;a href="https://github.com/azukacchi/notebooks"&gt;github&lt;/a&gt;.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Jupyter Book vs Jekyll for Github Pages
&lt;/h2&gt;

&lt;p&gt;Both will generate static site for you, which means you can write your pages in markdown and they will built your html pages based on the layout settings.&lt;/p&gt;

&lt;p&gt;(+) Native support for jupyter notebook file (ipynb). While you can put your &lt;code&gt;ipynb&lt;/code&gt; file to Jekyll (see the example from my page &lt;a href="https://azukacchi.github.io/portfolio/purchasing%20intention.html"&gt;here&lt;/a&gt;), it needs to be converted to html first before Jekyll converts it to another html with the predetermined layout settings.&lt;/p&gt;

&lt;p&gt;(+) Easier to install since you only need to install &lt;code&gt;jupyter-book&lt;/code&gt; and &lt;code&gt;ghp-import&lt;/code&gt; packages in your python environment. Less headache for Windows users since you don't need to install Ruby and/or Linux distribution.&lt;/p&gt;

&lt;p&gt;(-) No customized template available for Jupyter Book. Jekyll has plenty of themes (check them &lt;a href="https://jekyllthemes.io/"&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;If you still wish to build Github Pages using Jekyll, check &lt;a href="https://github.com/azukacchi/azukacchi.github.io"&gt;my tutorial&lt;/a&gt; and &lt;a href="https://azukacchi.github.io/"&gt;my page&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Live Version
&lt;/h2&gt;

&lt;p&gt;Check the live version of my Jupyter Book &lt;a href="https://azukacchi.github.io/notebooks/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Jupyter Book Tutorials
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Assumptions
&lt;/h3&gt;

&lt;p&gt;You are already familiar with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;git&lt;/li&gt;
&lt;li&gt;command line&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Steps
&lt;/h3&gt;

&lt;p&gt;The official tutorial from Jupyter Book covers pretty much all of the required steps. I added some notes based on my experience:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install Jupyter Book&lt;/p&gt;

&lt;p&gt;Starts from &lt;a href="https://jupyterbook.org/start/your-first-book.html"&gt;this page&lt;/a&gt;. Make a new environment, solely for making jupyter book and install the package there. I recommend to use Python 3.7.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;However, there is a known incompatibility for notebook execution when using Python 3.8.&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Tweak Some Files&lt;/p&gt;

&lt;p&gt;Follow the instructions from the beginning until the "Add it to your Table of Contents" part in &lt;a href="https://jupyterbook.org/start/new-file.html"&gt;"Create your own content file" page&lt;/a&gt;. I repeatedly encountered build failure which coming from Github Actions trying to build the references section in the later step. Remove &lt;code&gt;references.bib&lt;/code&gt; and comment out the line where it includes references in &lt;code&gt;_config.yml&lt;/code&gt; file. Proceed to the next steps, starting from "Re-build your book".&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Prepare &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/p&gt;

&lt;p&gt;When you finally get to "Publish your book online with GitHub Pages" part, you will need to setup &lt;code&gt;gh-pages&lt;/code&gt; branch (step 2). By now, your jupyter book is already available in your repository but not yet deployed as a page. Open your repository in browser (i.e. &lt;code&gt;https://github.com/azukacchi/notebooks&lt;/code&gt;) then create a branch called &lt;code&gt;gh-pages&lt;/code&gt;, which will contain all files as your &lt;code&gt;main&lt;/code&gt; branch. You should have two branches (&lt;code&gt;main&lt;/code&gt; and &lt;code&gt;gh-pages&lt;/code&gt;) in your repository. Finish the remaining steps.&lt;/p&gt;

&lt;p&gt;Note that you don't need to make changes to the &lt;code&gt;gh-pages&lt;/code&gt; branch, only the &lt;code&gt;main&lt;/code&gt; branch. Any changes made to the &lt;code&gt;main&lt;/code&gt; branch will be applied by &lt;code&gt;ghp-import&lt;/code&gt; package by overwriting all files in &lt;code&gt;gh-pages&lt;/code&gt;. The &lt;code&gt;gh-pages&lt;/code&gt; is solely used as the source for your Github Pages.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Notes
&lt;/h3&gt;

&lt;p&gt;When you want to update your book, you should always make your changes to the &lt;code&gt;main&lt;/code&gt; branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add ./*
git commit -m "update xxyyzz"
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then rebuild your book, i.e. for my &lt;code&gt;notebooks&lt;/code&gt; repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jupyter-book build notebooks/
ghp-import -n -p -f notebooks/_build/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>githubpages</category>
      <category>jupyterbook</category>
    </item>
    <item>
      <title>Setting Up Github Pages site with Jekyll Tutorial</title>
      <dc:creator>Azka</dc:creator>
      <pubDate>Mon, 22 Mar 2021 07:23:41 +0000</pubDate>
      <link>https://dev.to/azukacchi/setting-up-github-pages-site-with-jekyll-tutorial-1l60</link>
      <guid>https://dev.to/azukacchi/setting-up-github-pages-site-with-jekyll-tutorial-1l60</guid>
      <description>&lt;p&gt;This tutorial is cross-posted on &lt;a href="https://github.com/azukacchi/azukacchi.github.io"&gt;my github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Jekyll is a static site generator. With Jekyll, you can write your pages in markdown from which it will build your html pages based on the layout settings. For example, if the markdown file you're writing is &lt;code&gt;project1.markdown&lt;/code&gt;, Jekyll will build the &lt;code&gt;project1.html&lt;/code&gt; file for you. There's no need to tweak the html, css, or whatever it is for the layout unless you want to do some customization. The Jekyll theme you're using alone already allowed some customization (think of working with Bootstrap) and you can easily change them using the provided field. &lt;/p&gt;

&lt;h2&gt;
  
  
  Live Version
&lt;/h2&gt;

&lt;p&gt;Check the live version of my portfolio &lt;a href="https://azukacchi.github.io/"&gt;https://azukacchi.github.io/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Assumptions
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;You are already familiar with git&lt;/li&gt;
&lt;li&gt;You have the project documentation ready in markdown&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Tutorial Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://jekyllrb.com/docs/installation/windows/"&gt;setting up jekyll (Windows)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jekyllthemes.io/free"&gt;free jekyll themes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/github/working-with-github-pages/creating-a-github-pages-site"&gt;github pages official documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/pmarsceill/just-the-docs"&gt;"just-the-docs" theme source code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pmarsceill.github.io/just-the-docs/"&gt;"just-the-docs" theme documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/pmarsceill/jtd-remote"&gt;"just-the-docs" github pages DEMO&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Other reading&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://towardsdatascience.com/9-minutes-to-a-data-science-portfolio-website-80b79ced6c54"&gt;simplest tutorial&lt;/a&gt;, but you can't run your site locally&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Steps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Install Ruby and Jekyll
&lt;/h3&gt;

&lt;p&gt;Follow the instruction from this page &lt;a href="https://jekyllrb.com/docs/installation/windows/"&gt;for Windows&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prepare Your Project Folder
&lt;/h3&gt;

&lt;p&gt;We will prepare and test out pages &lt;em&gt;locally&lt;/em&gt; first. These first steps are modified from &lt;a href="https://docs.github.com/en/github/working-with-github-pages/creating-a-github-pages-site-with-jekyll"&gt;this&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make the new project folder. Choose any names, e.g. &lt;code&gt;myblog&lt;/code&gt;, because this won't be the name for your repository, as your default github page is &lt;code&gt;username.github.io&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Open command prompt and navigate to project folder.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose the directory where you are going to publish your site.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you choose to publish your site from the root of the repository, &lt;code&gt;/&lt;/code&gt;, your github pages will appear directly on the root, e.g. &lt;code&gt;username.github.io&lt;/code&gt;. If you choose this, you don't need to make any new directory&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you choose to publish your site from a specific folder of the repository, e.g. &lt;code&gt;/docs&lt;/code&gt;, your github pages will appear on that page, e.g. &lt;code&gt;username.github.io/docs&lt;/code&gt;. If you choose this, make a new directory, then navigate to that folder.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir docs
# Creates a new folder called docs
cd docs
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a new Jekyll site in the current directory&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jekyll new
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install your theme, e.g. "Just-the-Docs" theme. The default theme for new Jekyll site is "minima".&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gem install just-the-docs
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;add it to your Jekyll site’s Gemfile&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gem "just-the-docs"
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add Just the Docs theme to your Jekyll site’s &lt;code&gt;_config.yml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;theme: "just-the-docs"
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run your local Jekyll server then open your local site on browser: &lt;a href="http://localhost:4000"&gt;http://localhost:4000&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bundle exec jekyll serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Make Changes to Your Pages
&lt;/h2&gt;

&lt;p&gt;In this step, you can try adding some pages, customization, and test them locally. When you're changing the &lt;code&gt;_config.yml&lt;/code&gt; file, the update will not be applied unless you restart the server and run this line again: &lt;code&gt;bundle exec jekyll serve&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Always&lt;/strong&gt; check the theme documentation to write your pages and setting them up! When you want to customize your theme CSS, check the theme documentation.&lt;/p&gt;

&lt;p&gt;After you've completed setting up your pages and your site is running okay locally, proceed to the next step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Push Existing Project to Github
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a new repository on Github. Type a name for your repository. If you're creating a user site, your repository &lt;strong&gt;must&lt;/strong&gt; be named &lt;code&gt;&amp;lt;yourusername&amp;gt;.github.io&lt;/code&gt;. Do not add any files because we're going to push the files from local.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Unless you're already working in the root of your project folder, navigate to the root. Initialize git repository in the current directory (must be the root folder).&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Edit the Gemfile that Jekyll created.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add "#" to the beginning of the line that starts with gem "jekyll" to comment out this line.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the github-pages gem by editing the line starting with &lt;code&gt;# gem "github-pages"&lt;/code&gt;. Change this line to:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gem "github-pages", "~&amp;gt; GITHUB-PAGES-VERSION", group: :jekyll_plugins
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Replace GITHUB-PAGES-VERSION with the latest supported version of the github-pages gem. Check the version here: &lt;a href="https://pages.github.com/versions/"&gt;"Dependency versions"&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Save and close the Gemfile&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you're using Jekyll theme other than the &lt;a href="https://pages.github.com/themes/"&gt;supported themes&lt;/a&gt;, edit your &lt;code&gt;_config.yml&lt;/code&gt; file. For example, for "Just-the-Docs" theme, change this line: &lt;code&gt;theme: "just-the-docs&lt;/code&gt; to this:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;remote_theme: pmarsceill/just-the-docs
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;For another theme, check the theme documentation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From the command line, run &lt;code&gt;bundle update&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add your GitHub repository as a remote&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote add origin https://github.com/&amp;lt;username&amp;gt;/&amp;lt;username&amp;gt;.github.io.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then add, commit, and push your files to the remote&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
git commit -m "initial commit"
git remote -v
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open your github pages. If there's something wrong, e.g. theme doesn't load, check your email! When there's something wrong, you will get a Page build failure or Page build waning email.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Use a Customized CSS
&lt;/h2&gt;

&lt;p&gt;If you're using a customized CSS (e.g. changing or adding new styles) and run them locally, you usually edit the theme by editing a scss file in the directory of the theme. For example, for "Just-the-Docs" theme, your custom.scss file is in this directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\Ruby27-x64\lib\ruby\gems\2.7.0\gems\just-the-docs-0.3.3\_sass\custom\custom.scss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the path to the installed theme directory using this &lt;code&gt;bundle info --path "THEME-NAME"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;However, when you're running your page on Github Pages, you &lt;strong&gt;must&lt;/strong&gt; make the directory and the file yourself in the folder where you will publish your site. The exact directory is different for each theme, e.g. for "Just-the-Docs", the directory for the new file is &lt;code&gt;_sass/custom/custom.scss&lt;/code&gt;. You should follow your theme documentation when you add the contents of the new file. Example with Minima theme &lt;a href="https://docs.github.com/en/github/working-with-github-pages/adding-a-theme-to-your-github-pages-site-using-jekyll#customizing-your-themes-css"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>jekyll</category>
      <category>githubpages</category>
    </item>
    <item>
      <title>Deploy Flask Application to PythonAnywhere or Heroku (without database)</title>
      <dc:creator>Azka</dc:creator>
      <pubDate>Sat, 13 Mar 2021 05:21:46 +0000</pubDate>
      <link>https://dev.to/azukacchi/deploy-flask-application-to-pythonanywhere-or-heroku-without-database-3l8i</link>
      <guid>https://dev.to/azukacchi/deploy-flask-application-to-pythonanywhere-or-heroku-without-database-3l8i</guid>
      <description>&lt;p&gt;language: Bahasa Indonesia&lt;/p&gt;

&lt;p&gt;Contoh project: &lt;a href="http://nyc311-azka.herokuapp.com/"&gt;http://nyc311-azka.herokuapp.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source code: &lt;a href="https://github.com/azukacchi/nyc311_housing_buildings_analysis"&gt;github&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  PythonAnywhere (paling mudah)
&lt;/h2&gt;

&lt;p&gt;tutorial: &lt;a href="https://help.pythonanywhere.com/pages/Flask/"&gt;https://help.pythonanywhere.com/pages/Flask/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deploy di PYAW paling mudah karena tidak membutuhkan kita untuk menginstall aplikasi tertentu di komputer, tidak seperti Heroku yang membutuhkan aplikasi Heroku dan Git. &lt;/p&gt;

&lt;p&gt;Catatan:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Kalau aplikasinya tidak perlu memakai &lt;em&gt;package dengan versi tertentu&lt;/em&gt;, saran saya tidak perlu membuat virtualenv karena memori yang disediakan sangat terbatas (500 MB). Ketika menggunakan virtualenv memori akan termakan banyak untuk install package.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;File yang dibutuhkan untuk project kita tinggal di-upload ke PYAW. Jika project terdiri dari beberapa folder dan file (seperti project pada umumnya), akan lebih mudah jika satu kesatuan folder project kita (atau folder tertentu, misal hanya folder static) di-zip terlebih dahulu lalu di-upload di lokasi yang diinginkan.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Contoh: untuk project nyc311 yang membutuhkan file static dalam folder static, upload folder static yang sudah di-zip ke direktori /home/azukacchi/nyc311. File zip dapat di-unzip dengan cara: (1) membuka folder tempat file zip berada lalu "Open Bash console here", atau (2) buka bash console dimana pun lalu ubah direktori ke tempat file zip berada &lt;code&gt;cd /home/azukacchi/nyc311&lt;/code&gt;. Setelah bash console terbuka, ketik &lt;code&gt;unzip namafile.zip&lt;/code&gt; (dalam kasus ini namafile adalah &lt;code&gt;static&lt;/code&gt;). File zip yang terekstrak akan menjadi folder berisi file-file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m3O1R9ji--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9fezg6pdtp00s5u8mcu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m3O1R9ji--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9fezg6pdtp00s5u8mcu.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Jangan lupa isi detail aplikasi di halaman Web. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fsU4qVih--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6lp6mlh6ndwmudxowky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fsU4qVih--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6lp6mlh6ndwmudxowky.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k_MMjs_D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tpci6lghhzl3trwbonz8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k_MMjs_D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tpci6lghhzl3trwbonz8.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Heroku
&lt;/h2&gt;

&lt;p&gt;diadaptasi dari tutorial resmi: &lt;a href="https://devcenter.heroku.com/articles/getting-started-with-python#set-up"&gt;Getting Started on Heroku with Python&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Asumsi:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Heroku dan Git sudah ter-install (jika belum, lihat link tutorial)&lt;/li&gt;
&lt;li&gt;folder project sudah tersedia dengan (dengan atau tanpa menggunakan virtual environment), aplikasi Flask sudah berjalan OK di komputer dan siap di-deploy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Langkah-langkah:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Di dalam folder project, buat beberapa file dengan menggunakan Notepad bernama &lt;code&gt;Procfile&lt;/code&gt;, &lt;code&gt;requirements.txt&lt;/code&gt;, &lt;code&gt;runtime.txt&lt;/code&gt;, &lt;code&gt;.gitignore&lt;/code&gt; dengan rincian isi file sebagai berikut:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Procfile&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  web: gunicorn app:app
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;requirements.txt&lt;/p&gt;

&lt;p&gt;Semua package yang dibutuhkan untuk project kita. Tambah juga &lt;code&gt;gunicorn&lt;/code&gt; untuk webserver (install dengan pip terlebih dahulu). Contoh untuk project saya&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gunicorn
  flask==1.1.2
  imblearn
  plotly==4.14.3
  pandas==1.2.2
  numpy==1.19.2
  sklearn
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;runtime.txt&lt;/p&gt;

&lt;p&gt;Isi dengan versi python yang digunakan untuk project. Misal untuk project ini saya menggunakan virtual environment dengan python versi 3.8.5, maka isi file sebagai berikut.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  python-3.8.5
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;.gitignore&lt;/p&gt;

&lt;p&gt;Sesuaikan dengan project. Misal:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ## Cache
  __pycache__/
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Dengan asumsi seluruh file sudah final, langkah selanjutnya adalah menjadikan folder project kita menjadi repository git. Buka command prompt lalu buka direktori folder project kita dan ubah folder menjadi repository git. Lalu buat aplikasi heroku baru di folder tersebut. Contoh:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd "C:\Users\azuka\Drive Folder\Dash\311-nyc"
git init
heroku create
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Commit dan push. Perhatikan baik-baik log pada command prompt jika terdapat error pada langkah terakhir. Error bisa datang dari versi python yang tidak sesuai di file &lt;code&gt;runtime.txt&lt;/code&gt; atau ada package yang tidak tertera di file &lt;code&gt;requirements.txt&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
git commit -m "lalalayeyeye isi bebas"
git push heroku master
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Jika deploy sudah berhasil, pastikan satu instance app berjalan&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;heroku ps:scale web=1
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Ganti nama app lama (secara default di-generate random oleh Heroku) dengan nama yang diinginkan&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;heroku apps:rename newname
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Jika kita membuat perubahan pada aplikasi, cukup ulangi deploy dengan mengulangi langkah nomor 3. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>flask</category>
      <category>heroku</category>
      <category>pythonanywhere</category>
      <category>deploy</category>
    </item>
    <item>
      <title>Making a simple twitter autobase bot that posts incoming DM</title>
      <dc:creator>Azka</dc:creator>
      <pubDate>Tue, 08 Sep 2020 17:27:10 +0000</pubDate>
      <link>https://dev.to/azukacchi/making-a-simple-twitter-autobase-bot-that-posts-incoming-dm-1lmo</link>
      <guid>https://dev.to/azukacchi/making-a-simple-twitter-autobase-bot-that-posts-incoming-dm-1lmo</guid>
      <description>&lt;p&gt;Script can be found here: &lt;a href="https://github.com/azukacchi/twitter_autobase"&gt;https://github.com/azukacchi/twitter_autobase&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Description
&lt;/h2&gt;

&lt;p&gt;(Very) simple twitter autobase bot that posts incoming DM&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;h4&gt;
  
  
  1. Posts incoming DM that contains the trigger word.
&lt;/h4&gt;

&lt;h4&gt;
  
  
  2. Posts incoming DM with media. Three ways of sending a post containing media through DM:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Upload your own image with the text you want to add. However, DM will not be sent if it contains uploaded attachment other than photos (example: GIF/video). The result is something like this.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZZ6Wi5Yk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ir46br3cx7k86hvtuu3q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZZ6Wi5Yk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ir46br3cx7k86hvtuu3q.jpg" alt="upload image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Embed images/gif/video from an existing tweet by copy-pasting the link contained in a tweet with images/gif/video. Example: to embed the image from this &lt;a href="https://twitter.com/timeto_haechan/status/1300093500810170370"&gt;tweet&lt;/a&gt;, copy the text and take only the link.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The text would be something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;190831 인천 스카이 페스티벌 #NCTDREAM #NCT #해찬 #HAECHAN https://pic.twitter.com/r97xH3s15X
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Take only the link and paste it into the DM along with the text you want to add and the trigger word like below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your text hereeeeee lorem ipsum triggerword
https://pic.twitter.com/r97xH3s15
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is something like this.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Daj644N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/34zymz28b8uey2mpehl7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Daj644N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/34zymz28b8uey2mpehl7.jpg" alt="embed image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To submit a quote-RT of a tweet, simply insert the link of the tweet like below.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;this is going to be sent as a quote-RT your text hereeeee triggerword https://twitter.com/timeto_haechan/status/1300093500810170370
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is something like this. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pe7tKmOl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1nkyckowe9t1ysyhy5ho.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pe7tKmOl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1nkyckowe9t1ysyhy5ho.jpg" alt="quote rt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Cuts post longer than 280 characters and posts them as a thread. The result is something like &lt;a href="https://drive.google.com/file/d/1tNN0bW0QglARMCdUH1TAskUTtAztZjZ1/view?usp=sharing"&gt;this&lt;/a&gt;.
&lt;/h4&gt;

&lt;h4&gt;
  
  
  4. Sends a DM back for each incoming DM.
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;status &lt;code&gt;sent&lt;/code&gt;: DM was successfully posted, the link to the posted tweet will be attached.&lt;/li&gt;
&lt;li&gt;status &lt;code&gt;notsent&lt;/code&gt;: DM was not posted because it does not contain the trigger word.&lt;/li&gt;
&lt;li&gt;status &lt;code&gt;wrong attachment&lt;/code&gt;: DM was not posted because it contains uploaded attachment other than photo.
#### 5. Deletes the incoming DMs once they are posted. You can still see the content of the original DM from the link in the notification message you send back to the sender. Optional: you can also delete the notification DM you've just sent by uncommenting this line in &lt;code&gt;senddm&lt;/code&gt; method.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#api.destroy_direct_message(int(notifdm.id))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  6. Makes a log for each run into &lt;code&gt;test.log&lt;/code&gt; file.
&lt;/h4&gt;

&lt;h2&gt;
  
  
  What do you need
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Make sure you have already installed Python.&lt;/li&gt;
&lt;li&gt;A Twitter developer account; sign in to your Twitter account then apply for a developer account &lt;a href="https://developer.twitter.com/en/apply-for-access"&gt;here&lt;/a&gt;. The time required until your application is approved might varies (mine was 10-14 days 😬). After your application is approved, make sure to change the permission to the "Read, Write, and Direct Messages". Generate the keys and tokens after you change the permission setting.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to run this
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;If you have git installed, clone this in your directory. If not, just download the ZIP file.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  git clone https://github.com/azukacchi/twitter_autobase.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install the required packages (or check &lt;code&gt;requirements.txt&lt;/code&gt; to install each package separately).
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  pip install -r requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Set the required fields in &lt;code&gt;config.py&lt;/code&gt;:

&lt;ul&gt;
&lt;li&gt;Put the keys and tokens you get from your Twitter developer account.&lt;/li&gt;
&lt;li&gt;Set your timezone and the trigger word you want to use.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Modify the notification message as you wish in the &lt;code&gt;senddm()&lt;/code&gt; method.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How do I automate the script
&lt;/h2&gt;

&lt;p&gt;You can use Task Scheduler on Windows (open Start then search Task Scheduler) to run the &lt;code&gt;app.py&lt;/code&gt;. This app is quite simple to use, the only downturn is it only runs when your computer is either turned on or sleep but not shutdown (obviously). Some helpful tutorials can be found &lt;a href="https://www.jcchouinard.com/python-automation-using-task-scheduler/"&gt;here&lt;/a&gt; and &lt;a href="https://dev.to/abautista/automate-a-python-script-with-task-scheduler-3fb6"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Notes
&lt;/h2&gt;

&lt;p&gt;This bot is not suitable for a big autobase account. The &lt;code&gt;checkdm()&lt;/code&gt; method only checks the DM to your bot account, without saving the tweets to a dabatase. Then this bot will post the incoming DM as soon as it runs the &lt;code&gt;post_all()&lt;/code&gt; method, with a certain time span between the tweets to avoid Twitter API rate limits. To run a big autobase account with higher posts rate, coming from higher followers counts, such as &lt;a href="https://twitter.com/collegemenfess"&gt;@collegemenfess&lt;/a&gt; with 500K+ followers, you'll need to check the dm more often and you'll need a database that enables you to store the incoming DM and post them later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Questions
&lt;/h2&gt;

&lt;p&gt;I've just started this as a new hobby during pandemic, if you have any questions feel free to reach me on Twitter ahah ☺️&lt;/p&gt;

</description>
      <category>tweepy</category>
      <category>twitter</category>
      <category>python</category>
      <category>twitterbot</category>
    </item>
    <item>
      <title>Blocking twitter trolls (2): Blocking fancams</title>
      <dc:creator>Azka</dc:creator>
      <pubDate>Mon, 24 Aug 2020 13:15:14 +0000</pubDate>
      <link>https://dev.to/azukacchi/blocking-twitter-trolls-2-blocking-fancams-2ob8</link>
      <guid>https://dev.to/azukacchi/blocking-twitter-trolls-2-blocking-fancams-2ob8</guid>
      <description>&lt;p&gt;Earlier this year, a kpop translation account started running a script that blocks all trolls who post fancam under their tweets. We can now restrict who can leave a reply under our tweet but the feature is limited.&lt;/p&gt;

&lt;p&gt;If you're running a big account that provides content, you don't want to block all conversations under your tweet because after all, not all people are trolls. If you only want to reduce the number of trolls, in this case people who post fancam (related or not), this script is the answer. Another case of use of this script is if you want to read the conversations under a tweet WITHOUT having to go through all those fancam posts.&lt;/p&gt;

&lt;p&gt;This is what this script does: blocking all people who post fancam (video) under a certain tweet. You'll need a Twitter developer account (apply &lt;a href="https://developer.twitter.com/en/apply/user.html"&gt;here&lt;/a&gt;) with 'Read and Write permission'.&lt;/p&gt;

&lt;p&gt;Paste the link to the tweet then run the script. Full script can be found on &lt;a href="https://gist.github.com/azukacchi/99ab7cda0871c6719f5e33bd351ecfb1"&gt;my github&lt;/a&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


</description>
      <category>twitter</category>
      <category>tweepy</category>
      <category>python</category>
    </item>
    <item>
      <title>Blocking twitter trolls (1): Blocking retweeters</title>
      <dc:creator>Azka</dc:creator>
      <pubDate>Mon, 24 Aug 2020 12:29:38 +0000</pubDate>
      <link>https://dev.to/azukacchi/blocking-twitter-trolls-1-3a72</link>
      <guid>https://dev.to/azukacchi/blocking-twitter-trolls-1-3a72</guid>
      <description>&lt;p&gt;Twitter is one of the most popular platforms for fandom activities, especially my fandom, and for the past years I've found a lot of mutuals I like to interact with. On the other hand, the deeper you're into the fandom, the more you encounter unreasonable tweets. You have many options: ignore, mute, or block. If you wish not to engage with any of those people in the future, you can automatically block (or mute) the original poster and the people who retweeted with the script below. &lt;/p&gt;

&lt;p&gt;You'll need a Twitter developer account (apply &lt;a href="https://developer.twitter.com/en/apply/user.html"&gt;here&lt;/a&gt;) with 'Read and Write' permission. The full script is posted on &lt;a href="https://gist.github.com/azukacchi/0263fcc20f2a0ce8ba6ed06bdcffedcf"&gt;my github&lt;/a&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Note that by blocking them all at once you've shut down all the opportunities for any type of interaction with those people. I personally would like to read people's sentiment about a topic, but you'd know a troll tweet when you spot one. What this script does is block those people, but the judgment is yours. &lt;/p&gt;

</description>
      <category>twitter</category>
      <category>tweepy</category>
      <category>python</category>
    </item>
  </channel>
</rss>
