Skip to main content

Posts

Captain Levi Talked To Armin

At this point, Armin and the others start questioning their actions while Levi tries to justify what was happening.

Upgrading Gitlab Using Linux Package

Gitlab actively updates its products including the Community Edition (CE). The easiest way to install Gitlab CE on a Linux machine is by using the package manager. To add the repository to our system, we can run the following command. sudo apt update curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash Before we run the upgrade process, we should follow the recommendation of the version order. If not, we may end up breaking our Gitlab service. Upgrading one version to another version far greater may require upgrading from previous versions first, step by step. To check our current Gitlab version, we can visit <OUR_GITLAB_ADDRESS>/help . The upgrade recommendation can be found  HERE . Note, we are also suggested to upgrade our Gitlab regularly for security reasons. We can get the list of available versions HERE . To apply the upgrade on our machine, we can run the following command. sudo apt-get install gitlab-ce=<VERSION_C

Prototypal Inheritance in Javascript

Some programming languages support object-oriented approaches natively by providing a feature to create an object instance based on a class definition. Meanwhile, in Javascript, we know there is  class syntax, but it is just a kind of syntactic sugar that allows us to instantiate an object that can inherit some traits from another object or class definition in a similar fashion to other programming languages. In Javascript, a class is just a function with a  prototype property that maintain traits that can be passed down to other object instance. There are several ways to allow property inheritance in Javascript. Functional In this way, we utilize the Object.create() method built in Javascript. The steps are: Create an object as the prototype provider. Pass the prototype provider to the Object.create() method along with additional properties declaration if needed. For example, const provider = { sum: (a, b) => a + b }; const obj = Object.create( provider

Configuring Swap Memory on Ubuntu Using Ansible

If we maintain a Linux machine with a low memory capacity while we are required to run an application with high memory consumption, enabling swap memory is an option. Ansible can be utilized as a helper tool to automate the creation of swap memory. A swap file can be allocated in the available storage of the machine. The swap file then can be assigned as a swap memory. Firstly, we should prepare the inventory file. The following snippet is an example, you must provide your own configuration. [server] 192.168.1.2 [server:vars] ansible_user=root ansible_ssh_private_key_file=~/.ssh/id_rsa Secondly, we need to prepare the task file that contains not only the tasks but also some variables and connection information. For instance, we set /swapfile  as the name of our swap file. We also set the swap memory size to 2GB and the swappiness level to 60. - hosts: server become: true vars: swap_vars: size: 2G swappiness: 60 For simplicity, we only check the exi

Hiko Talks With Kenshin

 It was when Kenshin will leave for wandering.

HTTP Compression

When a server delivers some messages to a client using an HTTP protocol, data compression may be performed to save bandwidth. It can make the data size becomes smaller with the cost of CPU processes. Node.js has a built-in library to handle compression, as I mentioned in another post . For instance, we will see an HTTP server built on Fastify that utilizes the zlib module to compress data returned by the server module in the following code. import Fastify, { FastifyInstance } from 'fastify'; import { join } from 'path'; import { createReadStream } from 'fs'; import zlib from 'zlib'; const PORT = 3000; const fastify: FastifyInstance = Fastify({ logger: true }); fastify.get('/', (request, reply) => { // get request header const acceptEncoding = request.headers['accept-encoding'] || ''; const rawStream = createReadStream(join(process.cwd(), 'text.txt')); reply.header('Content-Type', 'text/plain

Configuring Network Interface on Red Hat Server

For this instance, we use a Red Hat Enterprise Linux (RHEL) Server 7.9. Unlike the latest Ubuntu version that commonly utilizes YAML-based configuration and the netplan tool for setting up IP addresses of network interfaces, the RHEL network interface can be configured using the configuration script located in /etc/sysconfig/network-scripts . Several interface configurations and scripts have been automatically generated by RHEL during the installation process. The configuration file is named by its device name such as ifcfg-eth0 for the eth0 device. If we run our RHEL in a VMware-based virtual machine, the device name might be shown up like ens35 or such things. The following configuration is an example of a network configuration with DHCP enabled. #/etc/sysconfig/network-scripts/ifcfg-eth0 TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="dhcp" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes&q

Deploying Network Infrastructures in AWS Using CloudFormation

AWS is undoubtedly the most complete cloud services provider. Even though its services are not always the best compared to other similar services, it is able to provide a variety of tools to help us build any kind of internet-based services. When we initially create an account in AWS, we instantly receive the ability to create a complex network within a Virtual Private Cloud (VPC). We can develop a VPC in a region on multiple data centers or availability zones. AWS allows us to configure and deploy our infrastructures using an IaC-based (Infrastructure as Code) service called CloudFormation. For instance, we will deploy a VPC with several network components in it. The components include internet gateway, subnet, NAT gateway, and routing tables. The VPC will be available in a single availability zone and hosts two subnets which are private and public. Firstly, we define the variables that will be referred to in the configuration within the Parameters block. It contains only the

Shikaku Talks To Shikamaru

It was after Asuma lost the battle with Akatsuki.

Phases of Node.js Event Loop

We know that a Node.js application is run in a single-threaded fashion. But, it can handle multiple asynchronous operations in the background and exhibits features as if it is a multi-threaded application. At the base level, Node.js is built on C++ which actually allows the existence of multiple threads. While that's not the actual basis, Node.js utilizes the  libuv library that allows it to interact with the operating system and utilize available resources efficiently. The library enables asynchronous I/O operations such as file reading, database querying, data transferring over the network, and so on, then it will trigger the registered callback for each completed I/O operation to run. Node.js manage all the callbacks in a mechanism called " event loop ". An event loop is a loop of sequential processes which are grouped into several phases. It handles callbacks of asynchronous I/O operations and asynchronous calls initiated by objects or functions in the main appl

Configure Gitlab SMTP Setting

Gitlab CE or EE is shipped with the capability to send messages through SMTP service as the basic feature to send notifications or updates to the users. The configuration parameters are available in /etc/gitlab/gitlab.rb . Each SMTP service provider has a different configuration, therefore the Gitlab configuration parameters should be adjusted according to the requirements. Some examples have been provided by Gitlab here . This is an example if you use the Zoho service. gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.zoho.com" gitlab_rails['smtp_port'] = 587 gitlab_rails['smtp_authentication'] = "plain" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_user_name'] = "gitlab@mydomain.com" gitlab_rails['smtp_password'] = "mypassword" gitlab_rails['smtp_domain'] = "smtp.zoho.com" This is another example of using Amazon SES w

Measuring Correlation

If we want to know a correlation between a boxer winning a match and using red pants, we can mathematically determine it based on past records of those conditions. There are four possible combinations of the conditions. The boxer loses and he doesn’t use red pants (00) The boxer loses and he uses red pants (01) The boxer wins and he doesn’t use red pants (10) The boxer wins and he uses red pants (11) For example, we have the following past records. Condition “00” is 23 times Condition “01” is 10 times Condition “10” is 45 times Condition “11” is 9 times Then, we can use the phi coefficient formula. The result of this formula is between -1 and 1. If the result is close to 0, it means the conditions have no correlation. If it is close to 1, it means the conditions are strongly correlated. Meanwhile, if it is negative, the correlation is strong but in the opposite way. The formula is as follows. phi = (n11 x n00) – (n01 x n10) / sqrt(n1X x n0X x nX1 x nX0) n1X represents the condition wh