In the last few months, I realized some people whom I really don't know are adding me as contacts in Linkedin. What I realized was that :
0) they had nothing to do with my industry, we had nothing in common.
1) most of these people had just joined Linkedin and had 0 contacts.
2) either their name or surname started with "a", which is my first name's and
lastname's initial.
I guess Linkedin devised a "dummy" algorithm for the newcomers. They redirect them to random people with the same initials to integrate them to the system (make their graph more connected). Weird.
Friday, February 28, 2014
Friday, February 21, 2014
Embedding Skulpt Python Interpreter in Reveal.js slides
Lately, Slide libraries in HTML+JS+CSS became so popular. I liked reveal.js the most and wanted to prepare a presentation on Python. I wanted to perform demos throughout the presentation so I thought I could embed a Python interpreter (skulpt) on slides.
See sample HTML file: https://gist.github.com/aladagemre/9124007
Just place your html file inside reveal.js folder. Place skulpt js files in reveal.js/js folder.
There exists two slides with the interpreter embedded. Just copy and paste those sections for having more.
See sample HTML file: https://gist.github.com/aladagemre/9124007
Just place your html file inside reveal.js folder. Place skulpt js files in reveal.js/js folder.
There exists two slides with the interpreter embedded. Just copy and paste those sections for having more.
Saturday, February 1, 2014
Flask, Facebook Canvas App, localhost and SSL
If you're developing a facebook canvas app with Flask, then you're asked to provide URLs for your app. Initially I used myapp.herokuapp.com address for http and https. But I realized that for testing local changes, I'd like to use localhost.
When I give localhost, it says it's not SSL supported. Then I had to create SSL certificates and install pyopenssl to use them. See: http://kracekumar.com/post/54437887454/ssl-for-flask-local-development
But what I saw was that connection was untrusted and I could not Add an Exception. I learned that browsers do not trust localhost for SSL. So I had to create an alias for my herokuapp. Added the following line to /etc/hosts
127.0.0.1 myapp.herokuapp.com
And set the canvas url as myapp.herokuapp.com for http and https.
Now when the app starts, tries to load https://myapp.herokuapp.com. It loads https://127.0.0.1:443 which is listened by the Flask app:
if __name__ == "__main__":
port = int(os.environ.get("PORT", 443))
app.run('0.0.0.0', debug=True, port=port, ssl_context=('/home/user/projects/myapp/server.crt', '/home/user/projects/myapp/server.key'))
This way I could overcome the SSL localhost problem for facebook canvas apps.
UPDATE: If you don't want to run the app as root, just forward port 443 to 3000 and listen 3000 port with the following command as root:
iptables -t nat -A OUTPUT -p tcp --dport 443 -j REDIRECT --to-port 3000
and to cancel it:
iptables -t nat -D OUTPUT -p tcp --dport 443 -j REDIRECT --to-port 3000
Note that forwarding 443, you won't be able to connect SSL web sites throughout your pc.
Maybe using vagrant could be more elegant.
Subscribe to:
Posts (Atom)