PHP Database SELECT and INSERT Example – php-pdo

LAMP is probably the most popular web stack in the world. It powers Wikipedia, and it powered Facebook for years.
To access your MariaDB database from PHP server side scripts, use PHP-PDO. Remember to use library functions to put user data into SQL strings (prepare, bind); and sanitize away any Javascript before showing data to users (htmlentities).

Continue reading

Posted in Uncategorized | Tagged | Comments Off on PHP Database SELECT and INSERT Example – php-pdo

Install MariaDB on Ubuntu 18.04 – Database Management System, the New MySQL

MySQL/MariaDB is probably the most popular multi-user database in the world.
Since Ubuntu 18.04, you should install mariadb-* packages to use this database.

Continue reading

Posted in Uncategorized | Tagged , , , , , , , | Comments Off on Install MariaDB on Ubuntu 18.04 – Database Management System, the New MySQL

CPU Usage Percent – Python One-Liner for Load Average per CPU

Processor usage is 88%. But how do I get a number like this?
For gurus, this Python one-liner prints CPU usage

$ python3 -c "print('{:.0f}%'.format( float('$(cat /proc/loadavg)'.split()[0]) / float('$(nproc)')*100 ) )"
12%

The rest of us can read on how this works. Also, we can learn how to read system state from plain text files and understand load averages.
Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , | Comments Off on CPU Usage Percent – Python One-Liner for Load Average per CPU

sshfs – Securely Mount Filesystems over the Internet – Survive Suspend and Network Down

Sshfs allows you to browse your own folders over the Internet.
It’s a real mount, a directory on your computer, so any program can access the files. And it uses SSH, making it very secure.

$ sshfs -o reconnect,ServerAliveInterval=5,ServerAliveCountMax=3 tero@example.com:/ mnt/tero/

Continue reading

Posted in Uncategorized | Tagged , , , , , | Comments Off on sshfs – Securely Mount Filesystems over the Internet – Survive Suspend and Network Down

Aikataulu DigiStartUp dig4tn024-3002 – syksyllä 2018 – molemmat 1p ja 2p – 10 op

English: Create your own digital product and find paying customers. Real customers, actual money. Course is in Finnish.
Luo digitaalinen tuote ja hanki sille maksavia asiakkaita. Siis oikeita asiakkaita, joilta saa oikeaa rahaa.

Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , | 33 Comments

Aikataulu – Monialaprojekti Infra pro4tn004-3001 – syksy 2018 – 10 op

English: Complete a project with a company as a client. Work with students from different tracks and backgrounds. Course in Finnish.
Starting projects: Collect and visualize logs with ERK. File server for film company. Identity Management. Video surveilance and system provisioning. Finnish Text to Speech. Fishing. All Free software.

Previous course feedback was very good, 4.1 out of 5. And students even published two books!

Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 24 Comments

Vulnerable Super Secure Password Recover – SQL Injection Example

Can you exploit OWASP #1 vulnerability? I wrote a simple vulnerable password recovery app for practicing SQL injections.
(Vulnerable) Super Secure Password Recover ™ is written with Python 3, Flask and Postgres. You can do bad code even with the best tools.
Continue reading

Posted in Uncategorized | Tagged , , , , | Comments Off on Vulnerable Super Secure Password Recover – SQL Injection Example

Install Metasploitable 3 – Vulnerable Target Computer

Metasploitable 3 is a ready made practice target for penetration testing. Vagrant installation takes just minutes.
Continue reading

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

Aikataulu – Linux palvelimet ict4tn021-3003 – to 8-14 – alkusyksy 2018p1 – 5 op

English: Learn to manage your own Linux server – in 8 weeks. Beginners welcome. Student feedback excellent 4.8 out of 5. Course is in Finnish.
Aloita nollasta. Opiskele 8 viikkoa ja hallitset omaa Linux-palvelinta.
Opintojakson suoritettuaan opiskelija:

  • Osaa hallita Linuxia palvelimena
  • Osaa tehdä tärkeimmät asetukset tärkeimmille palvelimille (Apache, OpenSSH)
  • Osaa asentaa www-ohjelmointiin sopivan alustan
  • Osaa tehdä itselleen uusia asetuksia palvelinohjelmistoihin ohjeiden avulla
  • Tietää esimerkkejä palvelintilan tarjoajista ja hinnoista sekä fyysisten palvelinten vastaavista ominaisuuksista
Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , | 41 Comments

ESP32 – Arduino Compatible 6 EUR DevBoard with WiFi and Sensors






ESP32 and a pen. Photo by Heikki Hietala.






My colleague Heikki Hietala experimented with ESP32. He could connect it to Eduroam, the world wide free WiFi network for students.
Heikki used it for building a network controlled version of his morse moai, but you could use ESP32 to build robots and Internet of Things.

ESP32 is Arduino compatible microcontroller, making it very easy to program. It could work nicely with IoT Rapid Prototyping Laboratory Setup I co-developed with Kimmo Karvinen.
Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , , | Comments Off on ESP32 – Arduino Compatible 6 EUR DevBoard with WiFi and Sensors