kriwil

aldiantoro nugroho. @kriwil. indonesia. part-time programmer. full-time dreamer. swift. elm. linux. ubuntu. python. django. vim. indiana pacers. manchester united. random.

  1. Camel-case JSON Renderer for Django REST Framework

    Because I'm too lazy to create python package for this. Just use it.

    Django REST framework version: 3.5.x

    — – —
  2. Auto-publish pelican blog to S3 using CircleCI

    While having blog powered by pelican is great (because it's fast), creating new post isn't really fun. There are more than one step to do it:

    1. writing the actual post
    2. upload to the server (in this case, S3)

    If you're on new machine, it's even more painful:

    1. clone the repository
    2. install pelican's requirements
    3. setup S3 credential
    4. write the actual post
    5. upload to the server

    CircleCi has given free tier for a while now. So I figured, since I'm using github for my blog content, I could use it's free continous integration & delivery service to publish my blog easily.

    I found a blog post that gives instruction to do that, but apparently it doesn't work. s3cmd couldn't get the access key ID and secret access key I set. Since CircleCi has awscli preinstalled, it's better to use that one instead. Pelican doesn't support awscli yet, so there's some steps need to be done to use that.

    1. update your Makefile to use awscli instead
    2. insert your AWS S3 access key ID, and secret key ID
    3. create circle.yml in your repository

    Here's how the circle.yml should be:

    dependencies:
      override:
        - pip install -r requirements.txt
        - echo -e "[default] \naccess_key = $S3CFG_ACCESS_KEY \nsecret_key = $S3CFG_SECRET_KEY \n" > /home/ubuntu/.s3cfg
    
    test:
      override:
        - echo "test"
    
    deployment:
      aws:
        branch: master
        commands:
          - make html
          - make s3_upload
    

    Now, everytime you push your commits to master, CircleCI will deploy them to S3. You should be able to see the deployment progress on you CircleCI dashboard.

    You don't need to create special environment to install pelican etc, just git and text-editor. You could even use github's feature to create blog post directly inside your browser (I wrote this using that!).

    new post via github

    — – —
  3. Windows 10

    systeminfo

    It's been two weeks since I'm using Windows 10 for work, so I guess I could say something about it.

    I've been wanting to try to do (web) development on Windows for a while. I know this is weird, and sounds backward. But with Bash on Ubuntu on Windows, I had high hopes that I could finally have gaming machine and could still do development on it.

    The main reason I finally did this is I need to fix my work on IE/Edge. I usually use BrowserStack for testing IE (I still do), but it's very painful to use it for a long period of time. It requires a good upload connection, and in Indonesia, "good" and "upload connection" don't go together in one sentence. So when I had a hard drive lying around, I decided that it's finally the time to install Windows 10. I won't go to OS installation details, you'll find those kind of things easily in other places.

    The first thing I tried after installing Windows is that bash-thing. I was so exited that I could finally use real shell on Windows. Well it works. Sort of. It's slow, and other than running some shell commands, it doesn't do much. I can't even access the server I created using python -m SimpleHTTPServer command. Probably I need to do some magic thing first. But it doesn't work when I tried it, and I was disappointed.

    Once I found out I can't access that simple HTTP server, I didn't even bother to try full python web development setup. I immediately downloaded VirtualBox and Vagrant and setup the environment there. Maybe I should write another post focusing on development setup on Windows.

    There aren't many things I missed when working on Windows. My daily applications usages revolve around browser, IDE, terminal, todo manager, email client, notes taking application. From those list, I miss terminal and todo manager.

    Even I mainly use Safari, I do use Chrome for development, so that's not a problem. And with Chrome's sync, I don't even see any difference. All the bookmarks and extensions are there. I do miss 1password's auto fill, and sometimes it hits me hard.

    Powerful terminal (and shell) is probably the main reason why development on linux or OSX is better if you're not developing for Windows platform. Yes Windows now have PowerShell, and yes maybe it's good, but I doubt it's better.

    Now, the good thing about Windows. Steam. Games on Steam to be exact. Yes you could install Steam on linux or OSX, but there are lots of games that only work on Windows. And I've been enjoying games again. I don't always play games, but it's nice to have them ready when I want to.

    So, yeah, I guess Windows will mainly be a gaming system for me. I still hope the bash will works flawlessly in the future. In fact, I just turned the Insider Preview on so I could get faster updates, hoping there are more updates to the bash.

    I'm writing this on Windows, and will build this on bash (I'm using pelican), so if you see this paragraph, it means it's a success.

    — – —
  4. PC Build Update

    Thanks to some dude, I remember I need to post an update for my PC build.

    Since that post, I've gradually uppgrade some parts of the PC. I've increased the RAM to 12GB (8GB + 4GB RAM — now I have one 4GB RAM stick lying around. Want to buy? email me!). I also add Samsung EVO 250GB SSD (for OS) and 500GB Seagate drive (for backup). Somehow The water cooling system suddenly stopped working so I had it replaced with original heat sink, but I replaced the fan with Noctua NH L9I to keep it silent. I also added APC Pro 550 for UPS because electricity in Indonesia isn't that good.

    One think I regret from the build was the small case. I should've bought bigger one since now I don't have many GPU choices to go with the case. I don't have any plan to upgrade it now, but it'll be nice to have options for VR-ready GPU at somepoint in the future.

    — – —
  5. On Less Decission

    One less decision to make. That's what comes to mind when I saw the picture of Zuck's clothes. With that kind of clothes setup, there won't be any confusion on what to wear every morning. He probably just wakes up, takes a bath, and grabs any t-shirt there. Quick and easy.

    Options are always good. Options are liberating. Options open to many possibilities. But sometimes, options are overwhelming. Sometimes, options are distracting. Sometimes, less options is better. Sometimes, just pick whatever there's to pick is nice. And relaxing.

    I've been trying to reduce options in my life in order to keep my focus to things I actually want to do. This has been the one of the bases of why I choose what I choose.

    — – —