200 Lines of Code Saves 20 000 EUR

My student Joram Puumala wrote a program to automatically configure routers. The CEO of NDC Networks, Markus Ahonen: “NDC is expecting to deliver over 5000 routers during 2018, so the calculable savings in direct effort are significant. Especially as handling … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , | Leave a comment

Automation of Router Configuration with Python & SSH

My student Joram is automating router configuration for NDC Networks. Joram configures Advantech B+B routers for NDC’s clients. The configuration is done using custom built Python Paramiko SSH script. The routers are configured for clients of NDC, an 8 person … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , | Leave a comment

Print Special Characters as Backslash Escapes – Python3 One-liner with Unicode Support

Let’s find that weird or invisible character that breaks your code $ echo “Hello in Finnish: Päivää”|python3 -c ‘import sys; s=sys.stdin.read(); print(s.encode(“unicode_escape”));’ b’Hello in Finnish: P\\xe4iv\\xe4\\xe4\\n’

Posted in Uncategorized | Tagged , , , , , , , , , , , , | Leave a comment

Using Web APIs with Python – Read Weather Forecast and Send to Your Own IoT Device

Do you want get weather forecast, BitCoin vs EUR valuation and know your power consumption? A lot of data is available on free APIs. Your program can just make a regular HTTP GET request – it’s just like loading a … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , | Leave a comment

Django on Apache – with Python 3 and Apache mod_wsgi on Ubuntu 16.04

Install Python 3 Django on Apache, similar to production installations. These terse notes show how to install Python Django, configure it to use templates and access PostgreSQL database. Finally, we create a simple app to read records from database and … Continue reading

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Write Python 3 Web Apps with Apache2 mod_wsgi – Install Ubuntu 16.04 xenial – Every Tiny Part Tested Separately

Python is a popular language for web applications, used by Youtube, DropBox, Facebook, Pintrest, Reddit, Instagram, Spotify, Washington Post and many others. Apache is the most popular web server in the world. Mod_wsgi is the recommended way to use Python … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , | 2 Comments

Internet of Things -työpaja ict8tn017-1 – intensiiviviikolla w12

Rakenna härveleitä, jotka puhuvat netin yli. Eli kehitä itse IoT-laite viikossa. Check out demo day & projects! / Katso demo-päivä ja valmiit projektit!

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , | 58 Comments

Offline References for HTML5, jQuery, CSS, Python, C++, Apache, PostgreSQL and others

Are you flying? Are you on a summer cottage far, far away? Internet working only on full moon? Download free offline references for developers. Including HTML5, jQuery, CSS, Python, C++, Apache, PostgreSQL and others. Update: direct link to download the … Continue reading

Posted in Uncategorized | Tagged , , , , , , , | Leave a comment

Internet of Things in Lapland – Demo Day

In just four days, students have designed and built their own Internet of Things devices. I’m teaching a workshop with Kimmo Karvinen. We’re with Art & Design students in University of Lapland, Rovaniemi.

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , | 7 Comments

Deploy Flask & Python3 on Apache2 & Ubuntu

Deploy Flask, a Python 3 microframework, on Apache web server on Ubuntu. Then you can write your own web pages in Python. Flask is a very simple framework for writing server side applications with Python. This article shows how to … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , | 12 Comments

Room Status Remotely with OfficeIOT – Haaga-Helia Student Project with Martela

My negotiation rooms are reserved, but is anyone actually there? What’s the utilization rate? OfficeIOT project helps you. It senses if people are in the room and sends this information to a server in the cloud. Users can then log … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Implementing Package-File-Service Pattern as a Salt Stack PyObjects Function

PyObjects renderer allows you to use normal Python functions to repeat actions. In this article, we’ll implement a Package-File-Service pattern as a reusable Python function.

Posted in Uncategorized | Tagged , , , , , , , , | Leave a comment

Salt Package-File-Service with Pyobjects

When you install Apache, the most popular web server in the world, you want to show web pages. In practice, you install the package, keep the service running and modify a configuration file. In configuration management, this is called package-file-service … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , | 7 Comments

Logging in Python – with function names, line numbers, command line -v -d and aliases v(), d()

Logging is tells you what’s going on when your run and often avoids useless comments. Log messages give you a real time feeling what’s happening in the program. And your advanced users might want to run ‘supercommand –debug’, too. This … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , | Leave a comment

ykl.txt – Text dump of Finnish Public Libraries Classification System

Convert Finnish library YKL classification XML dump to a text file.

Posted in Uncategorized | Tagged , , , , , , , , , | Leave a comment

Search Your Files with StackHay

StackHay can fulltext index your files. I published StackHay today. “During development, StackHay was tested. A sample data of 13 terabytes, 12 million files was successfully indexed, and fulltext of 1.9 million files (16%) was extracted.” – TeroKarvinen.com/stackhay/ StackHay is … Continue reading

Posted in Uncategorized | Tagged , , , , , , | 1 Comment

Kyy 0.2 Beta – Python Cheatsheet in Code

Kyy is Tero’s Python Cheatsheet in Code. Kyy shows you how to program the most common things in Python. Each concept is shown as a separate, stand alone program. This is the obvious stuff I don’t want to search for … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Two Books for Robot & Sensor Hackers

I’m finishing two new books for robot & sensor hackers. Would you like to get started with electronics and sensors? Are you ready to meet simple Arduino and Linux-based Raspberry Pi?  Read Getting Started with Sensors. Written with Kimmo Karvinen. … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , | Leave a comment

ShowRun – Focus Application Window or Launch

Showrun – show window, or run the program if it has no window. Download now. Use showrun in Launchers in your panel Easygest mouse gestures Keyboard shortcuts, such as xbindkeys, or your favourite desktop: XFCE, KDE, GNOME or even .icewm/keys. … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , | 5 Comments

Capture Program Output on Python – subprocess.check_output()

Run an external program, capture output. With pipe support. Prequisites: command line, Python hello world. One Liner Well, two lines if you count module import. Try it out in a python console: $ python >>> import subprocess >>> subprocess.check_output(“echo hello … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Windows and Buttons in Python – Ten Lines of PyGTK

It’s easy to write grahical user interface with python. Write twindow to a text file, then run it. $ nano twindow.py $ python twindow Do you see a window? Does it print some text to command line when you click … Continue reading

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

2dresize – Precise Window Placement without 3D Acceleration

Coding? Want to see browser on the left and code editor on the right? No problem, 2dresize can position your windows so that your display is excactly halved. Edit: You need 2dresize when running 10.04 LTS. Starting at Ubuntu 11.04, … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Python Annoyances

< ![CDATA[showTocToggle("+","-")]]>Table of Contents Python Annoyances Type Casting Required Future of Division Are You Reserved? Seekers of Truth Me, mySelf, and I Exit Only Python Annoyances Python’s goals include simplicity, lack of unnecessary boilerplate and being easy to understand. Python … Continue reading

Posted in Old Site | Tagged , , , , , , , | Leave a comment
  • Picks

  • Boxing Clock for AndroidOcton8 Diving T-ShirtsShaking Tower Panda Android GameLearn Chinese with Android
  • Student projects