Planet PyLadies Pune

August 13, 2018

Anwesha Das

Twitter from command line

Since the time I have started writing code, the toughest job for me is to be in peace with the black and green screen, the terminal. As it is being “The Thing” which keeps my lovely husband (ah ha, really?) from me. So as an initiative of my “peace making process” I have started doing my day mostly on this boring screen. A part of that is me trying to do twitter from the command line. Thus, let us make the (boring) terminal interesting.

To reach the aim I needed a Python module to access the Twitter api. I used a module called python-twitter. Click is a Python package to create command line applications. I used it to have a better command line interface. I used Microsoft Visual Studio Code as my primary editor. Like all previous projects, I am leaned on Jupyter Notebook to try out code snippets. I used Pipenv for the first time here.

import sys
import twitter
import json
import click

After importing the modules (as mentioned above) required, the job was to create the boolean command line flags through click, so,

@click.command()
@click.option("--tweet", "-t", is_flag=True, help="Does tweet.")
@click.option("--timeline", "-n", is_flag=True, help="Shows user's timeline.")
@click.option(
   "--directmessage", "-m", is_flag=True, help="Shows user's direct messages."
)

I learnt click from this blogpost, it was really helpful.

I wrote a config.json file where I have the required authentication details, such as consumer key, consumer secret, access token key, access token secret and user id. I got them from my Twitter developer account. In the account you have to set your access level as “Read, Write and Direct Messages”. I am creating an object of the twitter.Api class. I am passing different arguments, tweet, timeline and direct message to subsequently do tweet, see my timeline and get to see my direct messages, in the command line.

I used Black to format my code. Formatting of the code makes the code more readable and easy to review.

The next and final job was to upload it on [PyPI] using twine. For this I followed a blogpost I did earlier I The source code of the project is available on my github.

If you notice, I have used many things for the first time in this small learning effort. Projects of this size are really helpful to learn new things.

Happy tweeting (from the command line).

by Anwesha Das at August 13, 2018 06:07 PM

July 02, 2018

Pooja Yadav

Fedora Pune Meetup and Fedora 28 Release Party

 

On June 30,2018 we had Fedora Pune meetup at RedHat office, along with Fedora 28 release celebration.
Pravin Satpute started the meetup by a welcome note and a quick introduction session. After this Parag presented a talk on Modularity. As most of the audience were new, so he started with very basic concepts like repository, package, compose,  koji, bodhi , fedora build cycle. After making the people comfortable he started to talk about Modularity and explained the need and purpose to introduce this feature ie Too Fast vs Too Slow.
 
 After this we had quick 10 mins break, where swags were distributed and everyone was happy to get swags :)

After the break the audience was divided in groups according to the interest as some want to know how they can create a FAS account, some want to know about how to earn badges and some about how we can contribute to Fedora.

Suprith and Ompragash lead the group who didn’t had a FAS account. They helped them to create FAS account and in the end everyone in the room was having a FAS account, which was their first step to contribute to fedora

Pravin took a session on how we can contribute to Fedora and earn badges. He explained about various badges, and how they can be earned by contributing to various projects and area.
Amita took a session how we contribute to Fedora by testing. She explained about the basics of testings and bugzilla.

Apart from these session Parag and Praveen were also having some interesting discussion around Fedora features, so some people joined them. After this we did cake cutting to celebrate Fedora-28 release and had snacks having discussions about Fedora.

















It was a day well spent and great experience. Looking forward to next meetup.


by Pooja Yadav (noreply@blogger.com) at July 02, 2018 12:19 PM

May 25, 2018

Anwesha Das

How to use Let’s Encrypt with nginx and docker

In my last blog post, I shared the story on how did I set my server up. I mentioned that I’d be writing about getting SSL certificates, so here you go.

When I started working on a remote server somewhere out there in the globe and letting that come in into my private space, (my home machine) I realised I needed to be much more careful, and secure.

The first step to attain security was to set up a firewall to control unwanted incoming intrusions.
The next step was to create a reverse proxy in nginx :

Let us assume we’re running a docker container, a CentOS 7 host, using the latest ghost image. So first, one has to install docker, nginx and start the docker service:

yum install docker nginx epel-release vim -y

Along with docker and nginx we are also installing epel-release from which we will later get Certbot, for the next part of our project and vim if you prefer to.

systemctl start docker

Next I started the docker container, I am using ghost as an example here.

docker run -d --name xyz -p 127.0.0.1:9786:2368 ghost:1.21.4

Running the docker container in background. I am exposing the container’s port 2368 to the port 9786 of the localhost, (using ghost as an example in this case.)


sudo vim /etc/nginx/conf.d/xyz.anweshadas.in.conf

Now we have to set up nginx for the server name xyz.anweshadas.in, in a configuration file named xyz.anweshadas.in.conf. The configuration looks like this


server {
        listen 80;

        server_name xyz.anweshadas.in;

        location / {
                # proxy commands go here as in your port 80 configuration

                proxy_pass http://127.0.0.1:9786/;
                proxy_redirect off;
                proxy_set_header HOST $http_host;
                proxy_set_header X-NginX-Proxy true;
                proxy_set_header X-Real-IP $remote_addr;
                    }
}

In the above mentioned configuration we are receiving the http requests
on port 80. We are forwarding all the requests for xyz.anweshadas.in to the port 9786 of our localhost.

Before we can start nginx, we have to set up a SELinux boolean so that the nginx server can connect to any port on localhost.

setsebool httpd_can_network_connect 1 -P

systemctl start nginx

Now you will be able to see the ghost running at http://xyz.anweshadas.in.

To protect one’s security and privacy in the web sphere it is very important to know that the people or objects one is communicating with, are actually who they claim to be.
In such circumstances, TLS certificates is what we rely on. Let’s Encrypt is one such certificate authority, that provides certificates.

It provides certificates for Transport Layer Security (TLS) encryption via an automated process. Certbot is the client side tool (from the EFF) to get a certificate from Let’s Encrypt.

So we need a https (secure) certificate for our server by installing certbot.
Let’s get started

yum install certbot
mkdir -p /var/www/xyz.anweshadas.in/.well-known

We now need to make a directory named .well-known, in /var/www/xyz.anweshadas.in, where we will get the certificate for validation by Let’s Encrypt certificate.

chcon -R -t httpd_sys_content_t /var/www/xyz.anweshadas.in

This SELinux context of the directory, xyz.anweshadas.in.

Now we need to enable the access of the .well-known directory under our domain, that Let’s Encrypt can verify. The configuration of nginx, is as follows

server {
        listen 80;

        server_name xyz.anweshadas.in;

        location /.well-known {
                alias /var/www/xyz.anweshadas.in/.well-known;
        }

        location / {
                  # proxy commands go here as in your port 80 configuration

                  proxy_pass http://127.0.0.1:9786/;
                  proxy_redirect off;
                  proxy_set_header HOST $http_host;
                  proxy_set_header X-NginX-Proxy true;
                  proxy_set_header X-Real-IP $remote_addr;
         }

}
certbot certonly --dry-run --webroot -w /var/www/xyz.anweshadas.in/ -d xyz.anweshadas.in

We are performing a test run of the client, by obtaining the test certificates, through placing files in a webroot, but not actually saving them in the hard drive. To have a dry-run is important because the number of time one can get certificates for a particular domain a limited number of time (20 times in a week). All the subdomains under a particular domain are counted separately. To know more, go to the manual page of Certbot.

certbot certonly --webroot -w /var/www/xyz.anweshadas.in/ -d xyz.anweshadas.in

After running the dry-run successfully, we will rerun the command agian without dry-run to get the actual certificates. In the command we are providing the webroot using -w pointing to /var/www/xyz.anweshadas.in/ directory for the particular domain(-d) named xyz.anweshadas.in.

Let us add some more configuration to nginx, so that we can access the https version of our website.

vim /etc/nginx/conf.d/xyz.anweshadas.in.conf

The configuration looks like:

server {
    listen 443 ssl;

    # if you wish, you can use the below line for listen instead
    # which enables HTTP/2
    # requires nginx version >= 1.9.5
    # listen 443 ssl http2;

    server_name xyz.anweshadas.in;

    ssl_certificate /etc/letsencrypt/live/xyz.anweshadas.in/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/xyz.anweshadas.in/privkey.pem;

    # Turn on OCSP stapling as recommended at
    # https://community.letsencrypt.org/t/integration-guide/13123
    # requires nginx version >= 1.3.7
    ssl_stapling on;
    ssl_stapling_verify on;

    # modern configuration. tweak to your needs.
    ssl_protocols TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
    ssl_prefer_server_ciphers on;

    # Uncomment this line only after testing in browsers,
    # as it commits you to continuing to serve your site over HTTPS
    # in future
    # add_header Strict-Transport-Security "max-age=31536000";


    # maintain the .well-known directory alias for renewals
    location /.well-known {

        alias /var/www/xyz.anweshadas.in/.well-known;
    }

    location / {
        # proxy commands go here as in your port 80 configuration

        proxy_pass http://127.0.0.1:9786/;
        proxy_redirect off;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

To view https://xyz.anweshadas.in, reload nginx.

systemctl reload nginx

In case of any error, go to the nginx logs.

If everything works fine, then follow the below configuration.

server {
        listen 80;

        server_name xyz.anweshadas.in;

        location /.well-known {
            alias /var/www/xyz.anweshadas.in/.well-known;
        }

        rewrite ^ https://$host$request_uri? ;

}
server {
    listen 443 ssl;

    # if you wish, you can use the below line for listen instead
    # which enables HTTP/2
    # requires nginx version >= 1.9.5
    # listen 443 ssl http2;

    server_name xyz.anweshadas.in;

    ssl_certificate /etc/letsencrypt/live/xyz.anweshadas.in/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/xyz.anweshadas.in/privkey.pem;

    # Turn on OCSP stapling as recommended at
    # https://community.letsencrypt.org/t/integration-guide/13123
    # requires nginx version >= 1.3.7
    ssl_stapling on;
    ssl_stapling_verify on;

    # modern configuration. tweak to your needs.
    ssl_protocols TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
    ssl_prefer_server_ciphers on;


    # Uncomment this line only after testing in browsers,
    # as it commits you to continuing to serve your site over HTTPS
    # in future
    #add_header Strict-Transport-Security "max-age=31536000";


    # maintain the .well-known directory alias for renewals
    location /.well-known {

        alias /var/www/xyz.anweshadas.in/.well-known;
    }

    location / {
    # proxy commands go here as in your port 80 configuration

    proxy_pass http://127.0.0.1:9786/;
    proxy_redirect off;
    proxy_set_header HOST $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_set_header X-Real-IP $remote_addr;
    }
}

The final nginx configuration [i.e., the /etc/nginx/conf.d/xyz.anweshadas.in.conf] looks like the following, having the rewrite rule, forwarding all http requests to https. And uncommenting the “Strict-Transport-Security” header.

server {
        listen 80;

        server_name xyz.anweshadas.in;

        location /.well-known {
            alias /var/www/xyz.anweshadas.in/.well-known;
         }

        rewrite ^ https://$host$request_uri? ;

}

server {
        listen 443 ssl;

        # if you wish, you can use the below line for listen instead
        # which enables HTTP/2
        # requires nginx version >= 1.9.5
        # listen 443 ssl http2;

        server_name xyz.anweshadas.in;

        ssl_certificate /etc/letsencrypt/live/xyz.anweshadas.in/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/xyz.anweshadas.in/privkey.pem;

        # Turn on OCSP stapling as recommended at
        # https://community.letsencrypt.org/t/integration-guide/13123
        # requires nginx version >= 1.3.7
        ssl_stapling on;
        ssl_stapling_verify on;

        # modern configuration. tweak to your needs.
        ssl_protocols TLSv1.2;
        ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
        ssl_prefer_server_ciphers on;


        # Uncomment this line only after testing in browsers,
        # as it commits you to continuing to serve your site over HTTPS
        # in future
        add_header Strict-Transport-Security "max-age=31536000";


        # maintain the .well-known directory alias for renewals
        location /.well-known {

            alias /var/www/xyz.anweshadas.in/.well-known;
    }

        location / {
        # proxy commands go here as in your port 80 configuration

        proxy_pass http://127.0.0.1:9786/;
        proxy_redirect off;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header X-Real-IP $remote_addr;
        }
}

So, now hopefully the website shows the desired content at the correct url now.

For this particular work, I am highly indebted to the Linux for You and Me, book, which actually introduced and made me comfortable with the Linux Command line.

by Anwesha Das at May 25, 2018 05:04 PM

May 11, 2018

Anwesha Das

Is PyCon 2018 your first PyCon?

Is PyCon 2018 your first PyCon? Then you must have had a sleepless night. You must be thinking “I will be lost in the gathering of 3500 people.” There should be a lot of mixed emotions and anticipation. Are you the only one who is thinking this way? Do not worry it is same with everyone. How can I assure that? I had my first PyCon US in 2017 and I too like you and everyone else had gone through the same feeling.

Registration:

registration

Once you enter the area the first thing you have to do is to register yourself. The people at the registration desk are really helpful so do not hesitate to ask your heart out. If there is a problem ever helpful Jackie will be there to guide you. (If you meet her please say her “hi” for me :) ). And if you are volunteering please welcome first timers specially, it really makes them feel at home.

The registration is done and you have the schedule now. Mark the talks you want to attend and their respective halls too. You might want to set an alarm for that, as you might tend to miss them being busy in the hallway tracks (trust me I have missed a few!).

So now what to do? What are the interesting things to do in PyCon?

Hallway tracks

hallway

Hallway tracks are the best place to find friends. For many people this is the core of the conference. Many people prefer to attend hallway tracks more than actual talks :). People gather on the hallway and discuss not only Python or programming but culture, politics, business, food several non connected topic. Choose a conversation you are comfortable with and join. You might get your next project idea there. The same rule applies to the lunch time also. Do not be shy to talk to the person next to you. You might find the person who wanted to meet. People are welcoming here. Ask them if you can join they would generally love the idea. If you are regular at PyCon please include a new PyCon attendee in your group :)

Booth visit

The sponsors are the people who makes the conference run. So visit them. You might find the new, interesting gig you are looking for. And yes do not forget to collect the cool swags.

booth

5k Fun Run/Walk

If you love to run, you may like to join the 5K run. Ashley, is there at the 5K Fun Run/ Walk booth (turn to the right of registration booth) to help.Please pick up your bib, shirt, and information on getting to the park!

Board game night

Inquire about the board game night, if you are interested.

PyLadies Lunch

It is the lunch by and for the PyLadies. A gathering of women who love to code in Python. If you consider yourself a PyLady do attend it, talk about your local PyLadies chapter, your hardels and success. You never know one of your personal story might inspire another PyLady to grow and face her own struggle. You will find similar minded people over there. And never miss to give shout out for the PyLady who in anyway had inspired you. You may always take names instead of a name. If you are there please raise a toast on my behalf for Naomi, Lorena, Ewa, Carol, Betsy,Katie, Lynn,Jackie and yourself too :). So register now.

No photo please

PyCon gives you the space/right to be anonymous, not to be clicked. If you do not want to be clicked please get out of the frame and convey your wish. You can also ask the person to delete the photo which mistakenly has you.

The pronoun you prefer

While registering take the 'The pronoun I prefer' badge.

PyLadies Auction

Saturday night is the PyLadies auction. Be a part of this fun fair (with a good cause). Read about it here.

Quite room

If you want to work, want to be left alone, need some space in the gathering of 3500 people find the quite room.

First time speaker?

Are you speaking for the first time in PyCon? Nervous? Do not want to leave any room for mistake? Want to rehears your talk? There is a speakers room to practice. Another easy way to rehears is, grab someone (whose opinion you value) and give the talk to her. This will give you a proper third eye view and tentative response of the audience. Last year Naomi helped me to do this. She sat with me for hours and corrected me. Never had a chance to say, “Thank you Naomi”.

Poster Presentation and Open Spaces

Do not forget to visit Poster Presentation and Open Spaces and know what is happening at the current Python world.

Code of Conduct

PyCon as [Peter] says is the “holy gathering of the Python tribe”, we all are the part of a diverse community, please respect that. Follow the Code of Conduct. This is the rule book and at all time, you have to abide by. If you have any issue please do not hesitate to contact the staff. Be rest assured that they will take required measures. Lastly do not hold yourself back form saying “sorry” and “thank you”. These two magically words can solve many problems.

One thing for sure your life after these 3days will be completely different. You will be back wealthy with knowledge, lovely memory and friends.

friendsatpycon2

PS: A huge shout out for the PyCon staff for working relentlessly over the year to put up this great PyCon to you. And thank you for coming a =nd attending PyCon and making it a great event it is.

by Anwesha Das at May 11, 2018 04:17 PM

PyLadies at PyCon

In 2013, I was going through PyCon photos. The album was full of pictures of very serious looking geeks engrossed in their favorite back and green screen. Suddenly I saw the photos of people laughing, enjoying and joking . Many of them were women. Dazzled by the beautiful ladies, I asked my fortunate half(https://kushaldas.in/), “what is this place?”, “Who are these people?”

“This place is magic”, he replied. This was the night of the PyLadies Auction. Me, “What is PyLadies?”“PyLadies is a global mentorship group. It focus, helps women to take active part in Python open source community. They are group of women who love to code Python. And this is the night when PyLadies organizes this auction. The money collected here goes to PyLadies. So it fun, laughter, good time and a good cause all at the same place.” This, dear reader, was my first introduction to PyLadies.

And at that time I never (even in my wildest dreams) imagined that one day I would become a part of this beautiful group, and be fortunate enough to call these amazing ladies my friends.

From then on, every year I used to wait for these pictures to arrive. I was super excited when Kushal used to explain me the pictures,

“Heres Katie singing the ‘Let it go’ song to get a bigger bid for the Frozen poster.”
katiesinging-1
“This is Doug,he takes care of the auction."
doug
“ Look at Brett, as Andrea is biding."
andreabidding
I got to know each one of them before meeting them in person.

I started collecting interesting things all through the year, for the auction. And eagerly wait to know the amount of money it brought to the PyLaides account.

In 2017 I finally had the opportunity to be a part of this fun fair. And what a night it was!. I still remember each moment vividly. We collected $21,275/-, the highest till date.

I also noticed that anything to do with Python, (the common love factor) would sell in higher price. When I was collecting things for this year’s auction I kept that in mind. As I travelled to various PyCons I kept collecting items, that I thought would relate.

The first two things I got were from PyCon UK.

The thing that I noticed once I reached PyCon UK were the name badges. They had the characters of famous British personaliies, like Alan Turing, Sherlock Holmes, Dr. Who and several more on them. Those awesome-cool badges were designed by - Steve Hawkes.

The second is a pair of cool Python socks.

The PyCon UK organizers were really kind to give me a pair of those socks and the whole set of name badges. They were also signed by the designer Steve.

Next stop was PyCon India.

The opening keynote by Noufal Ibrahim. It was titled as “Mentoring - What, Why and How.” He discussed about the various aspects of mentoring relating many of his personal experiences. It was so informative and helpful. The thing apart form his keynote that caught everyone’s attention were his beautiful slides. Being the awesome calligrapher that he is, these were a beautiful set of calligraphic sheets. And also being the truly nice person he is, had graciously donated the original slides to the PyLadies auction. So while people in the conference were all praising them, I was like “Yeah! These are ours”.

PyCon India Day 1, after lunch I took a little time off from the PSF and the PyLadies booth and went to check out the other booths.

Something caught my attention, and I froze (literally) it was pencil sketch of Noufal. It was made by a girl named Shiny Parashar. This amazing artist had made the sketches of the three keynote speakers (lucky them). I was awestruck by those. Then an idea struck me, ‘What if she’d paint something for us to auction?’ And Shiny readily agreed. She came up with a gorgeous sketch of Gudio Van Rossum. Bonanza! It is now signed by Gudio himself.

guidosketch-1

Apart from the above mentioned items there are other cool items too such as PyCon Guitar, painting by Lynn Root, stained glass Python logos sponsored by nnja and Microsoft! and a surprise pack by Kaite, famously known as the PyLadies Auction Queen along with many other awesome stuff.

Thank you everyone for your kind donations and gracious endeavor,it is truly appriciated.

People at PyCon, come one, come all and be a part of this great, fun cause and help us spread Pythonomania all over the globe.
See you on Saturday night.

PS: If the your budget is tight and you lost the fight in auction, you can always go and collect PyLadies swag from the PyLadies booth.

by Anwesha Das at May 11, 2018 01:37 PM

May 06, 2018

Anwesha Das

Indian Government's new attempt to regulate "online content"

“Governments of the Industrial World, you weary giants of flesh and steel, I come from Cyberspace, the new home of Mind. On behalf of the future, I ask you of the past to leave us alone. You are not welcome among us. You have no sovereignty where we gather. ... Governments derive their just powers from the consent of the governed. You have neither solicited nor received ours. We did not invite you. You do not know us, nor do you know our world. Cyberspace does not lie within your borders. Do not think that you can build it, as though it were a public construction project. You cannot. It is an act of nature and it grows itself through our collective actions.”

  • Declaration of Independence by John Perry Barlow, February 8, 1996.

Internet was designed to be an open and free means of communication. Before the internet, knowledge was constrained in the lines of books, and later print media.

The books gave us the mind to think, an opinion to form. But it never provided us the space/way to raise our voice. The other problem was accessibility to the print medium of knowledge books. The mass/ the people unable to get access to the books, newspaper etc were living the life of a purblind.

Internet broke that barrier. It made the information available and accessible, making the mass/us worthy of forming our own opinion. It free in its spirit. Where people can speak their mind without being concerned about any superior lord, government or any other authority. In the words of late John Perry Barlow internet has the potential to giving a voice to everybody, which it has indeed.

But this immense power in the hand of mass does not really go well with the authorities, society, Government. The Government with the help of the state power tries to check, control, conquer us, our power, rights.The recent order, dated 4th April 2018, passed by the Ministry of Information and Broadcasting, Government of
India
is one of such attempt.

The order states to constitute a committee of 10 members to frame rules, regulate the online media, news portals, and online content. The committee shall deal, the terms of reference are as follows:

  • To delineate the sphere of online information dissemination which needs to be brought under regulation, on the lines applicable to print and electronic media.

  • To recommend appropriate policy formulation for online media / news portals and online content platforms including digital broadcasting which encompasses entertainment / infotainment and news/media aggregators keeping in mind the extant FDI norms, Programme & Advertising Code for TV Channels, norms circulated by PCI, code of ethics framed by NBA and norms prescribed by IBF; and

  • To analyze the international scenario on such existing regulatory mechanisms with a view to incorporate the best practices.

The threats lie within:

This abruptly designed order is vastly ambiguous and fails to be followed in the real life scenario. To further the point let us go through the order.

The subject of the order states that the committee shall frame “regulations for online media/news portals and online content ...”
The committee will not only regulate the online press but also “online content”. Whatever is there online, your personal blog, your social updates, pictures which give an individual user an information, experience which may be textual, visual or in any other form, forms an online content. Thus by the definition, the committee shall now on determine what we will post in our blog, website.

By regulating the “online content” our dear Government is trying to curb our voice, our opinion, our right to free speech and expression as guaranteed by the Article 19 of the Constitution of India. It will stop thinkers, scholars, activists, you to speak what they want to. It will make the job of the people in power easy to show what they want us to see, shape our mind as their wish.

My blog is my personal space. My online presence is an extension to myself. So, what I write, what I think is no one’s business, if I do it within the limits of reasonable restrictions enshrined by the Constitution. You may disagree, oppose but certainly not regulate what I do in my personal space. Therefore this order is also derogatory to our Right to Privacy.

This order is also faulty/bad on the point that it says the committee shall “delineate the sphere of online information dissemination which needs to be brought under regulation, on the lines applicable to print and electronic media”. Therefore according to this order even my small write up/ post regarding me getting an upset stomach is a news (wow, the Government is making us all celebrity). It will treated with same density (under the same laws) on a news on our Prime Minister signing a treaty with our neighboring country.

This order primarily forgets that the online space can not be bound by any territorial boundary.

Protest, don’t give up your freedom of speech and expression

We, the governed (not the subject), do not need the Government to define or specify the rules in cyberspace, our land, the space of mind. It is our time raise our voice against it.

Medianama has arranged an event, discussions on May 10th 2018, in Mumbai, at 12:30 PM on this issue, Online Content Regulation in India. Today, i.e 6th May 2018 will be last day to fill up the form to this invite only session. Please do attend the event, and strengthen the opposition against this derogatory order.

Funny but this makes me remind of a scene from “Hirok Rajar Deshe” by Satyajit Ray where the Scientist sales the King a machine to mold thought and understanding of the subject. Sadly our country is leading to that.

by Anwesha Das at May 06, 2018 04:19 PM

March 14, 2018

Anwesha Das

Setting up my own server

A long, long time ago a mortgage lawyer started to write her blog, just to get familiar with several crazy newfangled things called computers and the internet by using them to do something she liked, writing. So she started writing a blog using something called Wordpress.
The aim of the blog, was to explain legal terms, and theories in simple intelligible language. The blog was called lawexplainedindia.

Time flew; and with life’s funny, yet inevitable twists and turns, the lawyer landed into the world of computers; the world of Free & open source software and technology. So, the blog changed its face and got a new home at
https://anweshadas.in. It portrays what I think, and read, but not solely law now.

All these years, however I never took the responsibility of maintaining the website. Kushal, being the wonderful partner he is, used to do this painful job for me. He use to maintain it using a self hosted Ghost blog (Version 0.11.x).

I recently decided to take back the burden from Kushal. It would give me the opportunity of learning something new, becoming more familiar with the world of Free Software. I am now using a Digital Ocean droplet where the base operating system is CentOS 7. Setting that up was the easy part. Securing it and getting the blog to work, took some doing though. Here’s what I did …

Setup the firewall:

The first job was to setup the firewall rules to provide safety from the untrusted external network. I religiously followed Mohamed Raiyen’s post on hardening server security. That gave the droplet at least a semblance of safety.

Using official Ghost docker image

I wanted to use the latest Ghost as a platform to publish my blog.
There are two ways of doing that :

  • Ghost can maintain it for you, for a monthly or yearly subscription.
  • You can self host and maintain it yourself.

I opted for the second, by using the official docker container image.
The new ghost version provides an updated theme (Casper v2), but I liked my older version better. I copied my old theme (edited as required), all the images, and content into a directory /data.

The security context of the directory needed to be changed to access it inside the container by the following command

chcon -R -t svirt_sandbox_file_t /data

At PyCon US 2017, I had requested John Hawley to explain containers to me in a very naive non-technical way, one that a 10 year old would get.
Here’s how he put it …

“Imagine lots of little piggies in a sty. You have several naughty ones, which you do not want to get out of their own space and go into others.

Now the same theory applies to containers.
Here each sty is a container, where you are stopping your troublesome piglets (applications/programs) getting into others spaces.”

After this uh, interesting introduction, as I started to read more about containers, I came across an interesting comment by Dan Walsh that “Containers do not contain”, with a subsequent caution that if you want to use containers, one should use them following proper security measures.

This was the first time for me to use containers.
I played around with docker for few days before I used it here.

I am mounting the /data directory (from my machine) into /var/lib/ghost/content (in the container), as that is the content directory for ghost.

Now we can store the data even after the container stops running. I use the command below to start the docker container

docker run -d --name xyz -p 127.0.0.1234:2368 -v /data:/var/lib/ghost/content ghost:1.21.4

nginx as reverse proxy

I am using the nginx as the reverse proxy to the container. I also copy pasted the TLS certificates from Let’s Encrypt into the correct directory.
I will be writing about how to get a ssl certificate from lets encrypt in a subsequent blog post.

This particular project taught me to do several things at the same time, (all completely new to me) and gave me the real life production feeling :)
I learned each of these elements (docker, nginx, setting up a firewall, getting SSL certificates,) separately, and then combined them together as per the needs of the project — my shiny new blog. Though it took me a lot of time, frustration and a realization that the machine called computer is truly unpredictable (even more so than my unpredictable 3 year old). But at the end of all, when I witnessed my blog running at https://anweshadas.in, it was amazing.

by Anwesha Das at March 14, 2018 10:58 AM

February 13, 2018

Anwesha Das

The danger of modern medical devices : Keynote by Karen Sandler at LCA 2018

Karen Sandler the cyborg lawyer (quite literally; she has a defibrillator in her heart) has always been a source of inspiration to me. Unfortunate me has missed three invaluable opportunities to meet her in person. But I never miss a chance to see if I can meet, or see her online. So whenever she is giving a talk, I eagerly wait for the videos to come online.

I’m a big fan if you can’t tell :)

This year she was one of the keynote speakers at LINUXCONFAU,2018 and I was (as usual) is at the mercy of the conference organizers to watch her talk as soon as possible. They were very efficient. The video was posted really quickly
Thank You, LCA!

The first time I encountered Karen was in 2016 when I watched her [2012 Keynote at LCA, Freedom in my heart and everywhere. The talk pointed me to the problems which were an integral part of our life, crucial to our existence. The proprietary software in our medical devices and the danger lies in them. The lawyer in me started looking at all medical devices with a suspicious eye. Doctors appeared to me like Agent Smith and us patients, like Neo having some bug tracker inside our body.
On another very personal note, she was the first person who actually talked about something that I could understand, connect with, though it was technical at the core.

This year her keynote at LCA was titled: “Six Years Later, or Hey, did you ever get the source code to that thing in your heart?”. This talk is, in essence, the epilogue, to her 2012 keynote. It involved the dangers of having proprietary, closed source software in medical devices and generating awareness around it.The talk to me was a story connecting her personal life and her passion, software freedom.

She started her story with a question, which she was often asked after she gave her talk in 2012, “Hey did you ever get your source code?” By definition, a cyborg is “a person whose physiological functioning is aided by or dependent upon a mechanical or electronic device.” Pacemakers, hearing aids, even our innocent looking glasses make us cyborgs. If not all, at least a vast number of us humans, are cyborgs. The distinction between who is a cyborg and who is not is becoming increasingly blurred.

We all are in the process of becoming or unbecoming cyborgs.

And so, she aims to create a world where we have a number of free and open source alternatives to proprietary software. Moreover, she raised another fundamental point on the ethics of such software in devices that our lives, literally, depend on.

Being well aware of our ignorance, she walked us through various aspects of the legal, technical, community, and the social aspects of having buggy software in medical devices.
In her own words these wifi enabled devices "have the worst of both the worlds”, running proprietary software inside them and no security at all.

In the next part of her talk, she discussed the DMCA, Digital Millennium Copyright Act, 1998. It forbids, criminalizes any act to bypass access controls for devices like these, even if it is permissible under the Copyright Act itself. Therefore the passwords which the copyright holder has put in place cannot be changed. No exceptions, no exemptions. So under any circumstance, no one could check the security/safety of their own device.
Then she broke the good news on how she got the exemption, citing her own scenario. She shared her personal stories to explain the situations and dangers that lay.
She also ran through various incidents showing vulnerabilities of various medical devices.

The best part of the talk came in the closing moments, where this free and open source advocate held forth on how can we implement and follow free software in our daily life.

To summarise,

The talk enlightened us about existing and emerging threats in the sphere of medical devices.
Why and how free and open source software has solutions to many of these situations.
Most importantly she emphasized that we as a community have a responsibility towards making the situation better.

You are a true superhero, when you have skin in the game (literally your heart in the game) and can actually stick to your beliefs and passions, even your life is at risk.

Thank you Karen, for being able to think differently and for your constant efforts to make the world a better place.
Looking forward to your next talk. See you sometime, somewhere, and until then will adore you online.

To read further about medical devices and tracking, go to this post.

by Anwesha Das at February 13, 2018 05:19 PM

The danger of modern medical devices : Keynote by Karen Sandler at LCA 2018

Karen Sandler the cyborg lawyer (quite literally; she has a defibrillator in her heart) has always been a source of inspiration to me. Unfortunate me has missed three invaluable opportunities to meet her in person. But I never miss a chance to see if I can meet, or see her online. So whenever she is giving a talk, I eagerly wait for the videos to come online.

I’m a big fan if you can’t tell :)

This year she was one of the keynote speakers at LINUXCONFAU,2018 and I was (as usual) is at the mercy of the conference organizers to watch her talk as soon as possible. They were very efficient. The video was posted really quickly
Thank You, LCA!

The first time I encountered Karen was in 2016 when I watched her [2012 Keynote at LCA, Freedom in my heart and everywhere. The talk pointed me to the problems which were an integral part of our life, crucial to our existence. The proprietary software in our medical devices and the danger lies in them. The lawyer in me started looking at all medical devices with a suspicious eye. Doctors appeared to me like Agent Smith and us patients, like Neo having some bug tracker inside our body.
On another very personal note, she was the first person who actually talked about something that I could understand, connect with, though it was technical at the core.

This year her keynote at LCA was titled: “Six Years Later, or Hey, did you ever get the source code to that thing in your heart?”. This talk is, in essence, the epilogue, to her 2012 keynote. It involved the dangers of having proprietary, closed source software in medical devices and generating awareness around it.The talk to me was a story connecting her personal life and her passion, software freedom.

She started her story with a question, which she was often asked after she gave her talk in 2012, “Hey did you ever get your source code?” By definition, a cyborg is “a person whose physiological functioning is aided by or dependent upon a mechanical or electronic device.” Pacemakers, hearing aids, even our innocent looking glasses make us cyborgs. If not all, at least a vast number of us humans, are cyborgs. The distinction between who is a cyborg and who is not is becoming increasingly blurred.

We all are in the process of becoming or unbecoming cyborgs.

And so, she aims to create a world where we have a number of free and open source alternatives to proprietary software. Moreover, she raised another fundamental point on the ethics of such software in devices that our lives, literally, depend on.

Being well aware of our ignorance, she walked us through various aspects of the legal, technical, community, and the social aspects of having buggy software in medical devices.
In her own words these wifi enabled devices "have the worst of both the worlds”, running proprietary software inside them and no security at all.

In the next part of her talk, she discussed the DMCA, Digital Millennium Copyright Act, 1998. It forbids, criminalizes any act to bypass access controls for devices like these, even if it is permissible under the Copyright Act itself. Therefore the passwords which the copyright holder has put in place cannot be changed. No exceptions, no exemptions. So under any circumstance, no one could check the security/safety of their own device.
Then she broke the good news on how she got the exemption, citing her own scenario. She shared her personal stories to explain the situations and dangers that lay.
She also ran through various incidents showing vulnerabilities of various medical devices.

The best part of the talk came in the closing moments, where this free and open source advocate held forth on how can we implement and follow free software in our daily life.

To summarise,

The talk enlightened us about existing and emerging threats in the sphere of medical devices.
Why and how free and open source software has solutions to many of these situations.
Most importantly she emphasized that we as a community have a responsibility towards making the situation better.

You are a true superhero, when you have skin in the game (literally your heart in the game) and can actually stick to your beliefs and passions, even your life is at risk.

Thank you Karen, for being able to think differently and for your constant efforts to make the world a better place.
Looking forward to your next talk. See you sometime, somewhere, and until then will adore you online.

To read further about medical devices and tracking, go to this post.

by Anwesha Das at February 13, 2018 05:19 PM

December 10, 2017

Samridhi Agarwal

WebMaps with Python

After few months of busy schedule in college, Today I got the time to sit back and play with python applications. So I started learning WebMaps with python and folium.

As WebMaps the name only says that its the demonstration of Maps using browser. They can not be made using the default functions of Python because for the browser application we need CSS, HTML and JavaScript. So we need to convert the python code into the HTML code. Folium, a third party library does the same.

We need to pip install folium, after that we import it in the project. How folium works is – Everything spins around a map object, So we create a map object and store it in a variable.

import folium
map = folium.Map

Here folium.Map is the class that creates the object “map”. You can do dir (folium) to see different functions and you will find Map there. Then we can do help (folium.Map) to get the parameters and what we can give in that class.

Screenshot from 2017-12-10 22-29-19Screenshot from 2017-12-10 22-32-41

In the parameters we see the Location attribute to specify the coordinates on the world Map.Width- which means you can specify the width of map to be displayed on browser window, otherwise 100% by default means it uses full browser window to display.Tiles is background of map and so on.

So We can give the location attribute and see the location. In the location attribute the coordinates are given as [latitude, longitude].

import folium
map = folium.Map([-90 , 50])

Now we have a map object in python code but it is not converted to HTML. So we point the map object and use save method to save it in the html form, creating a new html file. Map will be created in HTML format, So html is containing all the elements that render on the browser.

import folium
map = folium.Map([-50 , 50])
map.save("Map1.html")

So I got a Map1.html file having the map of my latitude and longitude mentioned and as it is interactive mapping we can zoom in and out to see more details. Zoom parameter can also be added as (zoom_start = 6) and see changes with different zoom factors.

screenshot-from-2017-12-10-22-53-06.png


by samridhiagarwalblog at December 10, 2017 05:28 PM