Category: freedom

  • Early Preview: telegram-pybot – A Telegram Bot based on Plugins, written in Python

    We have all used and loved Yago’s telegram-bot written in Lua as an extension for Vitaly Valtman’s tg-cli for making funny Telegram bots. But Lua was keeping a lot of people away from making meaningful plugins.

    Alternate approaches included adding a –json flag to vysheng’s tg-cli and parsing that data or building wholly native APIs for Telegram in java or other languages. Liberbot is an excellent example.

    Now, the developers at Datamachine Studios have come up with a Python interface for building bots. I have tested it and it works very well, even at this very early stage.

    Screenshot of the bot listing its plugins on command

    What?
    Spartanly named “telegram-pybot” (for now, hopefully), what these people have created is a wrapper around vysheng’s tg-cli. They did this by patching the cli with Python interfaces and contributing to the upstream (that’s the beauty of free software).

    Why not native Python API?
    Apparently, the developers of telegram-pybot started out making plugins for the Lua bot. Later when they realized they wanted to switch to Python, it was easier to mimic the Lua binding API in Python rather than deal with the whole logic of Telegram (which keeps updating the schemas every now and then too). And many people are trying their hand in developing a pure Python API, should any of them become stable telegram-pybot is in a good space to switch to such a native interface with very little work in the future.

    “It’s kind of a pipe dream of mine to work on a python API, but one thing at a time right now” says Phillip Lopo who’s one of the two main forces behind the bot.

    Python vs Lua
    In my experience, Lua can only be at best called a scripting language, albeit a powerful one, while Python is a power packed, complete programming language. The sheer number of libraries available in Python and the pythonic way of doing things makes development in Python much more easy compared to Lua. Also, threading is a huge weakness in Lua which has mostly been solved in telegram-pybot already.

    Plugins
    The sweetest feature of telegram-pybot is its plugin management system. It is promising even while currently undergoing heavy development. Plugins are organized by repositories. One can search, list, install, update, etc the plugins available in a repository. Soon multiple repositories will be supported so that anyone can maintain their own list of plugins in a repository and others can easily get hold of more plugins, thus also avoiding a single point of failure.

    And the plugins themselves run quite smoothly, and cause no trouble even when they crash. Installing new plugins, restarting the bot, etc can be done over a Telegram chat thereby making them super easy to use (even for a non-developer)

    License
    Licensing bots, especially when they are powered by plugins is a confusing affair (read about the licensing of Yago’s bot). GPL offers no protection to bots that run over the network and therefore if one has to choose a copyleft license, it must be AGPL.

    But the developers of telegram-pybot want to give away as much freedom as possible. “I want people to use it, and I want the option for people to write private plugins for private communities” says Vincent Castellano, the co-developer. So there’s a good chance they will settle for MIT or BSD license when they finish their primary work on the code.

    With all that said, the bot is still in active development, as their readme says:

    “While already very capable, this bot is still in relatively early
    development. Some plugin names, or plugin API calls may be modifed.
    However, we are starting to settle on our stable APIs.”

    But you should check it out already — github.com/datamachine/telegram-pybot


    When I discovered telegram-pybot last night, I was very excited. And I developed a plugin which we’re enjoying in our FSM-K Telegram group. It is so easy to build that I want anyone with a computer to try, and therefore I’ve written a tutorial on my website.

  • Internet Will Become Dramatically Useless in the Near Future, Unless What is Said in This Happens

    Allow me to introduce you to “net neutrality” if you haven’t heard of it yet.
    Hindu had an editorial about why it is important yesterday.

    Net Neutrality is the concept that all data traffic on the Internet should
    be considered equal. There shall be no discrimination.

    So, say,
    if you pay for 1MBps Internet, your ISP should give you 1MBps itself
    (neither high, nor low) no matter if you use torrents, or WhatsApp, or
    Facebook, or Wikipedia, or YouTube, or whichever site/service you’re
    connecting to.

    But, for people like Reliance, Airtel, Uninor,
    Vodafone, etc this is bad for their pocket. Because people won’t send
    SMS or make phone calls, they can get money only via data packs. And
    they are greedy for making more money.

    So, what they have been
    trying to do, is to charge people differently if they’re using Viber,
    WhatsApp, Facebook, etc. This comes in the form of “free” Wikipedia,
    “free” Facebook offers, or “special” Facebook packs, “special” WhatsApp
    packs, etc. These all give differential treatment for different
    services. And that is bad!

    Last week, they forced TRAI to release a
    consultation paper for “regulating” (read: putting restrictions on) these services (Over The Top services
    – Whatsapp, Facebook, etc.). According to this paper, a lot of ideas –
    like licensing the OTT services, slowing them down unless you pay TSPs
    more, making the OTTs pay the TSPs, etc – are being considered to be put
    in place.

    A lot of people are already campaigning to protect the
    Web by keeping it neutral. Example:

    What we need to do is: raise awareness of why net neutrality is important, and ask stakeholders to send their comments to advqos@trai.gov.in

    You can read more analogies and get links to the paper at learnlearn.in/net-neutrality/

    If anything is unclear, please ask in comments.

  • Free and Open-Source Software

    Imagine you discovered how to make a delicious cake. You are the only person in the world who knows how to make it. It is so tasty that you could make a fortune selling it. What would you do?


    If the first thought that came to your mind is to start a bakery and make profit out of selling the cake, think again.


    There would have been one point in your life when you did not know what a cake is. From that point, all your knowledge about cakes came from people around you. Sure, you made a discovery with your own effort, but the world empowered you to make that discovery.


    Now imagine, instead of making profit out of the cake, you let the recipe out. You let everyone in the world know how to make your cake. Suddenly, you are making a lot of people happy.


    Slowly, others modify your recipe to make even better cakes. Even you enjoy the new variations. And the whole world is grateful to you. You are immensely satisfied.


    But the world is not fair. Sometimes the world goes for less tasty, but heavily advertised cakes with top-secret recipes. And you wilt away into oblivion while the world conveniently forgets about your beautiful contribution to the world. The picture isn’t so rosy, is it?


    Image: “Free Software” by user ryyo on flickr



    Replace the cake with software and you just read a small introduction to the Free and Open-Source Software (FOSS) philosophy.


    If FOSS, “anyone is freely licensed to use, copy, study, and change the software in any way, and the source code is openly shared so that people are encouraged to voluntarily improve the design of the software.”


    Creating such software most often does not bring economic prosperity to the developer (the person or group who creates the software). But to a large extent, they always enjoy the satisfaction that is obtained from people’s appreciation of what they have made. Also, the world gains so much because others can make contributions (extra features, fixing security bugs), which will again benefit everyone using the software.


    But we do not code, what can we do? We can not be a cruel world. We can support this cooperative culture and appreciate the effort of those developers who are willing to share, learn, and create better products that we all use daily to make our lives easier.


    Here is a list of most common FOSS packages for you to use.
    Mozilla Firefox – for browsing
    GIMP – for photo editing
    Libre Office – for word processing, spreadsheet, presentations, etc.
    VLC – for playing media files
    7-zip – for file compression
    (compiled from) Wikipedia – for sharing knowledge!

    (ɔ)  Copyleft (No rights reserved)

  • How and Why To Switch to Zsh from Bash

    Ubuntu comes with Bash as its default “shell”. So, when you’re running `gnome-terminal` (the default terminal emulator) it actually sends the commands to ‘/bin/bash’ which interprets your command and displays output.

    What is the difference between shell, console, and terminal?

    Zsh is an improvement on bash. It adds more functionality, and better ways of doing things.

    Bash vs Zsh | /r/linux

    Image from Oh My Zsh

    Switching to zsh is a “do once, be grateful for ever” task thanks to Oh My Zsh.

    As explained on Getting started with ZSH on Ubuntu (for technotards), you need to first install zsh.

    sudo apt-get install zsh 

    Then you can install Oh My Zsh

    curl -L http://install.ohmyz.sh | sh

    Change Shell
    At the end of the Oh My Zsh installation script, there’s a command to change the default shell to zsh (from bash, or any previous shell). But this might fail by not asking for a password. In case this happens, do this manually.

    chsh -s `which zsh`

    Important: Changing shell needs you log out and log in to take effect.

    Configure
    Zsh has a lot of configurations, and Oh My Zsh does these for us. Now you can configure Oh My Zsh!

    Enable plugins
    In .zshrc, change

    plugins=(git)

    to, say

    plugins=(git common-aliases autojump python sudo)

    With common-aliases, you can do `vim .zshrc` by `zshrc`.

    Themes
    Oh My Zsh comes with 137 themes. Set a random theme to load at startup by changing in .zshrc

    ZSH_THEME=”random”

    Override plugins (optional)
    The common-aliases plugin has “j” alias for jobs. Autojump uses “j” to jump directories. To resolve conflicts like these, just make your own custom version of the conflicting plugin. Like I copied ‘~/.oh-my-zsh/plugins/common-aliases’ to ‘~/.oh-my-zsh/custom/plugins/common-aliases’ and edited the ‘common-aliases.plugin.zsh’ in that to comment out the “alias j=’jobs’”

    Migrate .bashrc and .bash_aliases (optional)
    If you had custom settings in ‘~/.bashrc’ or ‘~/.bash_aliases’ that you want to copy over, you can copy them to ‘~/.zshrc’

    Alternately, you can create an Oh My Zsh plugin of your own by creating a *.plugin.zsh file in custom/plugins directory.

    Enjoy (required)
    Open a new terminal (Ctrl+Alt+T), and see a fresh terminal

  • Why I Love Telegram Messenger and Love Not Whatsapp Messenger

    Whatsapp is huge. There is no argument against that. Everyone who has an Android phone is using whatsapp.

    And this post is not about why you should stop using whatsapp. This post is about why I love Telegram Messenger.

    Open Source
    Telegram Messenger is open for anyone to crack, or hack, clone, and improve. This is the biggest reason why it is the best among all messenger apps.

    Cloud storage
    Telegram supports multiple devices simultaneously for the same account. This is possible because all your messages are stored on the cloud.
    This gives you two advantages – you never need to back up your messages, and you can move between your phone, laptop, tablet, whatever and continue your conversations where you left off.

    Secure
    Telegram and whatsapp are like a metallic lunch box and paper wrap respectively, when it comes to security. Telegram even allows you to encrypt conversations such that only the recipient can read it.

    File Sharing
    Telegram allows you to send files. You can share pdf, mp3, doc, ppt, all those files you want to quickly send to a friend without having to resort to email or without using a pen drive.

    Additionally,
    Groups on telegram can be up to 200 members. Anyone can add new members.
    Free as in free water. The people behind telegram is the people behind vk.com, the world’s second largest social network. They have enough money to keep telegram running free for practically long enough.
    Fast, though it is always arguable.

    And the best for the last,
    Availability on multiple platforms
    Telegram has an official Android version and iPhone version only. But due to its open nature it has countless windows phone versions, a web version, a windows desktop version, and even a linux cli version mentioned on its website. That is not to mention the fact that you could develop your own client using the open source protocol.

    In fact, I even built a bot based on telegram.

    Give telegram at whirl, checkout telegram.org