Skip to main content

Posts

Installing APCu in PHP 7

APCu is one of caching application for PHP. In this case, I use PHP 7.0 on Ubuntu 16.04. In PHP 7.0, this application is provided via PEAR. First, install PEAR. $ sudo apt-get install php-pear Install APCu. If an error occured state that there's no phpize, you need to install PHP 7.0-dev which provide phpize support. $ sudo apt-get install php7.0-dev $ sudo pecl install apcu Create APCu module configuration in PHP modules directory. $ sudo echo "extension = apcu.so" >> /etc/php/7.0/mods-available/apcu.ini Add that configuration to PHP FPM and CLI. $ sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/fpm/conf.d/30-apcu.ini $ sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/cli/conf.d/30-apcu.ini Restart PHP FPM.

ESP-01 Flashing Circuit

ESP-01 board is different from NodeMCU DevKit (ESP-12E) board. It doesn't have USB support. You need a USB to TTL serial converter and a certain circuit to switch the board between normal boot and flashing mode. You can buy a USB to TTL converter as cheap as $1 or you can utilize your current Arduino board. First, I want to show my simple circuit using a USB to TTL converter to flash ESP-01. I use Prolific USB to TTL. It's the cheapest device you can get in the market. If you use this device on Windows operating system, you must check Device Manager and validate that the device isn't in an error state. If it's an error, you can use the solution from  HERE . The following image shows the circuit for flashing ESP-01 using a USB to TTL converter. I use an external 3.3V supply because my Prolific can provide only a 5V supply from USB and the current is too low. USB to TTL to ESP-01 If you are too lazy with push-button and resistor you can use the followin...

X Japan

X Japan is one of Japan's most popular heavy metal bands, and I’m a fan of most of their tracks. Their music has a powerful vibe that hits me. One of the tracks that got me hooked on X Japan is "Kurenai." Recently, while watching concert videos from the 2000s, I noticed that one of the members, the guitarist known for his bright red hair, was missing. I learned that Hide, the 33-year-old guitarist, had died in 1998 due to suicide, according to police reports. X Japan had been disbanded in 1997, and Hide had started a solo career since then. While he still had a certain project with another music group in 1998, he was found dead in his house. His death was followed by the copycat suicides of three of his fans. In 2007, X Japan was reinvented and launched a new album. In the 2008 concert, something was touching. Hide was recalled by showing his image as a holographic projection on the stage. Based on the words of netizens, X Japan had used Hide's guitar-recor...

Hardening SSH Security in Linux

SSH is a popular network protocol used to access remote computers through certain networks or the internet. OpenSSH is an application that provides SSH accessibility for a computer or server. A common method used to start a communication with SSH access is by providing a username and password before a secured connection is established. This method is not really safe because you provide credentials in plain text and transfer them through the network. It also makes it any scumbag individuals be easier to guess your password or perform a brute force attack in order to gain your server access. There are several possible ways that I think can be used for hardening your SSH security. Disable root access Change SSH port number Utilize RSA authentication Disable plain password login Disable root access 1) Before you disable the root access, you need to make sure that there is another user account on your remote computer. 2) Create a new user as needed. $ adduser youruser 3) Edi...

Flashing NodeMCU Firmware on ESP Board

NodeMCU is popular firmware for ESP8266 WiFi SoC. When you buy a NodeMCU ESP8266 board, it must have been flashed with the firmware. But, you can also flash it anytime by yourself, for example when you want custom NodeMCU firmware. For complete documentation of NodeMCU, you can see it  here . There are a few steps to flash your board firmware. In this example, I use NodeMCU DevKit 1.0  with ESP-12E core which is easy to get in the market. If you use ESP-01, you need to see my other post about the ESP-01 flashing circuit . 1. Build the firmware. The easiest way is to build from the cloud , just follow the steps then the firmware will be sent to your email. 2. Install esptool.py. It is a python application to communicate with the ESP ROM bootloader. You can install it either from python package manager using pip install esptool or download manually from Github repository here . $ git clone https://github.com/espressif/esptool.git There are several other tools that you ca...

Film Misteri Asia Terbaik

Akhir-akhir ini saya sedang tertarik menonton film-film misteri, horor, atau thriller asia. Berikut ini beberapa film-film misteri asia terbaik yang saya rekomendasikan. 1. Audition (1999) Sebuah film thriller yang cukup menyeramkan (sadis) khususnya pada bagian akhir film. Bagian awal film banyak menceritakan kehidupan tokoh utama yang membuat kita penasaran tentang apa yang akan terjadi selanjutnya dan misteri apa yang akan terkuak. Film ini mengisahkan seorang pengusaha sukses yang istrinya telah meninggal sejak lama dan meninggalkannya seorang anak. Setelah lama sendiri akhirnya dia memutuskan mencari seorang pendamping. Setelah ia menemukan seseorang yang ia percaya cocok untuk dirinya, hal yang menyeramkan terjadi. 2. Lesson of the Evil (2012) Film ini adalah sebuah film thriller misteri yang menceritakan seorang guru SMA yang tampil sebagai seorang yang baik-baik namun ternyata menyimpan suatu misteri yang menyeramkan. Pada awal film kita akan melihat seorang guru yang ...

Setup MongDB on Windows

Download and install MongoDB . You can set custom installation directory or let default location in "C:\Program Files\MongoDB\Server\<version>". Add "C:\Program Files\MongoDB\Server\<version>\bin" to environment variable. Create directory for database data and log data. For example, database is in "C:\mongodb\data\db\" and log is in "C:\mongodb\log\". Create MongoDB configuration file. For example, it is in "C:\mongodb\mongod.conf". systemLog: destination: file path: c:\mongodb\log\mongod.log logAppend: true storage: dbPath: c:\mongodb\data\db (CAUTION: Use spaces, not tabs) Start the server by: $ mongod --config "C:\mongodb\mongod.conf" OR install it as a Windows service $ mongod --config "C:\mongodb\mongod.conf" --install Then, start the service. $ net start MongoDB To stop the service. $ net stop MongoDB To remove the service after stoping the service. ...

Enabling Single Webcam for Multiple Applications Access in Linux

A webcam can not be accessed by two or more applications simultaneously. The solution is you can duplicate the video stream and make it available for any application. In short, you create a virtual webcam. First, a webcam is commonly detected on  /dev/video* . Before you go through the steps to duplicate video stream, you should check whether your webcam is working. You can try to capture video using VLC by this command. (For example, your webcam is on  /dev/video0 ) $ vlc v4l2:///dev/video0 If it doesn't work, you can try to change its mode to 0777 and make sure there are no other applications accessing it. If it still doesn't work, you can buy a new webcam. Seriously. Don't buy a cheap and unknown-brand webcam. I have $5 webcam and it had wasted my time. $ apt-get install ffmpeg linux-generic v4l2loopback-dkms FFmpeg is the main application that will access your webcam and duplicate its video stream. V4L2loopback is needed to create multiple virtual capture devic...

Retrive Real Client IP in Nginx

Sometimes, your web application is installed in a web server which is behind reverse proxy server like Cloudflare or other services. In that condition, your application will always read the reverse proxy server IP as client IP. In Nginx, you can use ngx_http_realip_module to get the real client IP ( see detail ). To enable this module, you need to make sure that you use latest Nginx server from repository or you can build it from source with --with-http_realip_module  configuration parameter. I  prefer to install it from repository as Nginx 1.10.0 in Ubuntu 16.04 has enabled this module by default. You can check whether it's enabled or not by following command. $ nginx -V Then, the reslut should be like: $ nginx version: nginx/1.10.0 (Ubuntu) ... ... --with-http_realip_module ... ... Now, you can put the module configuration in http block or server block of your Nginx configuration. For example, you use Cloudflare service for your web application. You should lis...

Setup Free SSL Certificate with Certbot

If you want to setup a site with HTTPS, you need a valid SSL certificate from Certificate Authority (CA). Let's Encrypt is a CA that can provide you a free valid SSL certificate by requesting it using certain software. The software which is recommended by Let's Encrypt is Certbot . From the main page of Certbot site, you can choose what web server and operating system you use then it will show you the installation steps. For example, I use Nginx on Ubuntu 16.04. $ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:certbot/certbot $ sudo apt-get update $ sudo apt-get install python-certbot-nginx $ certbot --nginx Last command will get a certificate for you and have Certbot edit your Nginx configuration automatically to serve it. Sometimes, you may get error notes. It is about failure of integration process to existing web server configuration. It's not crucial cause you can integrate manually with simple steps. If you only want to get cer...

Books

I have liked reading books since I was a kid. Thanks to my parents, who let me buy any books and encouraged me to read. The bookstore has become one of my favourite places. I like to learn about any topics, not only about science or IT stuff. For me, reading a book isn't always intended to have possession of the topic, but it's for my personal pleasure and to build an insight into something. There are many things around us that we don't understand really well. If we try to figure it out by ourselves, we will waste most of our precious time. So, it's better to learn from the expert who has studied it well and then consider it with our common sense and logic. I grew up, many affairs had occurred, and shit happens. I realise that I have forgotten a lot of things. I likely tend to be aware of fewer things. So let me open a cupboard full of books which I've collected for a long time.

Master Slave Replication to Automatically Backup Your MySQL Database

We can make backup for some databases by periodically running a kind of dump query, like mysqldump in MySQL. That's the simplest method but it can drain our server resources and it's not suitable for large databases. MySQL comes up with master-slave features that allow you to replicate your database to another location (slave). This mechanism enables MySQL to generate a log file which records any action performed to the database. Then, that action will be run in slave database too. For example, we have two database servers with IP address 192.168.0.1 (Master) and 192.168.0.2 (Slave). 1) Configure my.cnf in master server # Master Settings # locate where the changes record will be stored log-bin = /var/log/mysql/mysql-bin.log # set unique ID for master database in master-slave network (up to you) server-id = 111 innodb_flush_log_at_trx_commit = 1 sync_binlog = 1 # select database which will be replicated # by default system will log all databases binlog-do-db = ...