Skip to main content


Showing posts from December, 2018

How to use Custom CSS/Javascript in Android WebView

By default you cannot get custom CSS/Javascript loaded into Android Webview. We should override the onPageFinished method to be able to add custom CSS/javascript to Android Webview. This example is using Kotlin, you may search something else if you're using native Java code or Flutter. The best approach to use Custom CSS/Javascript is by creating the style node containing CSS and a script node containing the javascript for your sites. var node = document.createElement('style'); node.type = 'text/css'; node.innerHTML = 'MY_CSS_STYLE'; document.head.appendChild(node); and var node = document.createElement('script'); node.type = 'text/javascript'; node.innerHTML = 'MY_JS_SCRIPT'; document.body.appendChild(node); and override the onPageFinished method: override fun onPageFinished(view: WebView, url: String) { val code = """javascript:(function() { var node = document.createElement('style');

How to Create Flask Server with Raspberry Pi

On this very basic tutorial, we gonna create a simple Flask Server with Raspberry Pi. Flask is python microframework which allows you to create a web based applications. This time, we'll install Flask and using NGINX as the default webserver, altough the similar way can be reproduced using Apache. Prepare your SD Card and burn the latest Raspbian Image onto the SD card using the tool like 'Etcher' or 'dd' command in Linux/MacOS. Power on you raspberry pi, and take a moment, be sure your Raspberry Pi is connected to Internet, through Wi-Fi or LAN. Then update the repository and packages on Raspberry Pi with this command: sudo apt-get update Install the required software, like NGINX, pip3 (python installer) and uWSGI (micro-WSGI): sudo apt-get install nginx sudo apt-get install python3-pip sudo pip3 install uwsgi To install Flask Microframework, use the pip command: sudo pip3 install flask Create Flask App and Nginx Configuration In your home directory, create new dir

How to Create FTP Server with Raspberry Pi

Raspberry Pi revolutionised electronics and computer hobby nearly 6 years. Too many creative project has been created with this tiny computer. On this simple tutorial, we'll create a simple FTP server with Raspberry Pi. This tutorial as intended to Raspberry Pi 3 Model B user, but it also practicable to other version of Raspberry Pi with some modification. You will need: a Raspberry Pi 3 Model B or other version, a SD Card with the latest Raspbian/ARMbian images or other Debian-based distribution for Raspberry Pi Power supply Keyboard or monitor or LCD Install FTP Server You must set your IP Address as static IP. To know your ip address, use command like ' ifconfig' . You also need to enable and start SSH Server for more easy to use in the future. Install vsftpd using this command: sudo apt-get update sudo apt-get install vsftpd Configure FTP Server the default FTP server is located in /etc/vsftpd.conf. Configure and tweak your ftp server by modifying some of those paramet