A Brief Intro Before starting the Linux Kernel Mentorship Program from Linux Foundation , I used to work as a web developer. With how chaotic web development has become , I decided to take a career break. I have been interested in the low-level programming, so I use my time during this career break to learn more about low-level programming. With that in mind, this blog post’s perspective is…
At the time of writing this blog post, i recently learn about virtual memory. So i am curious, how can we trigger the same memory address on different process? After reading this gcc wiki , it looks like we can use setarch to do that. First thing first, we need to create a simple program to print the memory address. For this example, i am going to use C programming language, like this:
Brief Intro I have seen some people said that strcpy() can be dangerous to use. At that time, I am not sure why strcpy() can be dangerous, but now I have found a simple replication of why strcpy() can be dangerous. This is also the case with strncpy(), which does not guarantee a null terminated string. At the time of writing this blog post, I am still getting started learning C programming…
DISCLAIMER: Keep in mind that at the time of writing this blog post, i am still learning about C programming language and lack experience to validate the information from the low-level perspective. This blog post act like my public notes, which might be wrong. When i read this article about self-pipe trick, i found this code snippet: ... struct sigaction sa; memset(&sa, 0, sizeof(sa)); ... That…
A Brief Intro When i take a look at bash’s documentation about shell redirection , i found out that this two examples are different. This one: ls > dirlist 2>&1 and this one: ls 2>&1 > dirlist So let’s try understanding why it is different. What 2>&1 means? From this hacker news comment , it looks like the expression 2>&1 is like calling system call dup2(2, 1). If we take a look at the…
DISCLAIMER Keep in mind that this is only an analogy to help newcomer understand pointer to array in C programming language. This does not mean there’s any sort of compression when we use pointer to array. &arr vs &arr[0] In case you didn’t know, we can get the address of an array using the address-of operator like &array. Here’s an example: #include <stdio.h> int main(void) {…
A Brief Into I am always confused when trying to understand what is considered an lvalue in C programming language, so let me try to explain that to make me have a better understanding of lvalue in C. What is Lvalue? From C committee draft definition : An lvalue is an expression (with an object type other than void) that potentially designates an object; if an lvalue does not designate an object…
A Brief Intro Recently i watch “Bread on Penguins” video about shell process substitution on youtube. I already know about shell process substitution and write the blog post about shell process substitution as temp file , but what is interesting from the video is the combination of shell process substitution and shell redirection that i didn’t think about previously. Shell…
When we learn another programming language for the first time, we were told that to access an array, we can use indexing. For example, let’s say we have an array with 5 items and the index array start at 0. With that in mind, we can access the 5th item in those array like array[4] (remember, the index start from 0, so it’s 0, 1, 2, 3, 4). But in C programming language, array can…
When we talk about something that have “artificial” in it, we tend to associate that with something that “does not exist naturally”. But recently i read article titled Bag of words, have mercy on us , and this footnote caught my attention: Even the word “artificial” is wrong, because it menacingly implies replacement. Artificial sweeteners, flowers, legs—these are things we…
At the time of writing this post, there’s some sort of AI hype going around, and some of the testimonies is that AI make people “learn faster” or “doing stuff faster”. With that in mind, let’s talk about how this mentality can be bad. First off, some people want to “learn faster”, and i’m like and then what? What would these people do after…
Recently i watched Dr. K’s video on youtube . He talks about “why ‘the grind’ isn’t meant for everyone” and one of things he said on those video is this: We live in a society that glorifies exhaustion at work. And that make me thinking, that’s not the end of it. If you ever talk to a friend and said “i have a lot of tasks at work” and then…
At the time of writing blog post, human still trying to emulate human’s intelligence on machine. This concept usually called Artificial Intelligence. This attempt has gone for quite sometime, there’s even the hype cycle of it. When the artificial intelligence (a.k.a as AI) is not meet the current hype expectation, we will enter AI winter period. From my observation, if we want to make…
Recently i finished reading Peter Naur’s essay called Programming as Theory Building and i think that essay describe what i like about programming, that is “building a theory” or i usually called it “designing a system”. I like to think of myself as “designer” when i’m programming, because in a way, i’m basically designing some sort of…
Recently i found someone’s status about “getting accused of using AI when we didn’t”, so let’s talk about it. Here’s the status, in case anyone curious: Before we start, i just want to say that the term AI in here means “Artificial Intelligence”, not “Another Idiot” or “Actual Indian”. With that in mind, let’s get…
Recently i watch a talk by Lu Wilson on youtube about What it means to be open and that talk kind of resonates with me because that’s exactly what i am trying to achieve, which is “to be open”. It’s not only about the source code, it’s about being human. Nowadays i feel like there is some kind of pressure “to be perfect”, “to have no mistake”,…
At the time of writing this post, i am still learning about C programming language, and one of the topics about C programming language is “pointer”. I know that there’s a lot of analogy about pointers out there, one of the common one is about house and house address, but i want to share the analogy that help me understand about pointer. Imagine there’s a company called RAM…
A Brief Explanation Let’s say we have int i = 0;, and imagine there’s a temporary object (rvalue?) to store the result of i + 1 for the ++ operator. Object is an area of memory that is used by our program, and temporary object in here means that the object has a temporary duration and will be deleted when the containing full expression ends. Full expression here means:
Recently i read about Simon Sinek’s post about would you still lead if no one ever knew your name? and my answer to those question is a solid “yes”. Here’s the story, back then we have two senior-level teammates on our team, one of them is in the official leader of the project and another one is not. Because i am new at my role, i am still struggling at the beginning of the…
A Brief Intro I need to replace data on one database server with data on another database server. Let’s call it server 1 for the source server and server 2 for the target server. But there are 2 limitations: We only need to replace data on specific table. We only able to access the database through psql with VPN (at least that’s how i understand it). With that in mind, i’m trying…
A Brief Intro At work, i need to build an API that enable user to update specific info in multiple rows. Previously, i made a blog post about postgres update multiple data in one query , but those method is more convenient for running raw sql in the postgresql database directly rather than for API. I mean, sure, we can use FROM (values (...), (...), ...) but personally, i don’t really want…
Setup Miryoku in QMK Disclaimer: By the time of writing this post, there’s a breaking change in QMK that remove user keymaps, including miryoku. And miryoku QMK haven’t porting it’s config in the new QMK userspace. So this section might become obsolete in the future. For reference: https://github.com/manna-harbour/miryoku/discussions/287 First thing we need to do is to setup QMK.…
For backend development at work, we just transitioned from Node.js to golang recently. We use pgx as our PostgreSQL driver. I’m not quite sure why we choose pgx as our PostgreSQL driver and not using ORM like gorm, so we won’t talk about that here. My principal is to adapt to the tech stack that the project use rather than forcing what i’m familiar with, so i don’t really…
As vim gaining popularity these days, I’ve heard some complaint about configuring vim is hard. Not only learning vim motions is hard, making vim usable for the user is also hard. Well, in case someone haven’t realize, configuring vim is basically a programming activity which can be a good thing or a bad thing, depending on your preferences. Because configuring vim is hard for new user,…
Let’s say we try to develop a feature B, but those feature need feature A which haven’t merged already. So, to prevent the diff changes getting larger, we create new branch to develop feature B. And then, in the middle of development of feature B, the branch that contains feature A got merged into main branch and all the commit from feature A got squashed into one commit. And when we…
A Brief Intro Have you wondered “how can we test a linux kernel without breaking our linux operating system installation?”. One of the method is using virtual machine (VM) and in this post we’ll use arch linux in virtual machine to try out different version of linux kernel. There are 2 scenarios that we will discuss on this post: Using arch linux VM with arch linux as host…
A Brief Intro In this post, we’ll install arch linux on virtual machine with QEMU and add a shared directory between host machine and virtual machine. Before we start, make sure to install QEMU on your system. If your system using arch linux too, we can install qemu-base and tigervnc package. tigervnc package for viewing the virtual machine from QEMU. We will be using SeaBIOS, which is…
After watching video about acme in this article , which introduces the concept of Integrating Development Environment instead of Integrated Development Environment which usually abbreviated to IDE, i thought to myself “why not having a development environment without integration at all?”. This might sound crazy for some people, but this is my development environment at the time of…
Over the years i’ve been thinking whether having a high intelligence is a blessing or a curse. Humans, who supposedly have the highest intelligence over other living creatures on earth, seems like having more stress than other living creatures. With those high intelligence, human make a lot of innovation and one of them is electricity. One of the benefit of electricity is that electricity…
A Brief Intro For those who read this article without knowing what dotfiles are, it’s basically a configuration files. The purpose of backing up dotfiles is so that we don’t need to reconfigure our tools on a new system. There are a lot of ways to backup and manage dotfiles, and one of them is using git. In this article we will explore how to backup and manage dotfiles using git, the…
One evening i read an article about if bill gates could ask a time traveller, he’d want to know whether AI eventually doomed or helped humanity . Those question is quite interesting, no one really know if artificial intelligence (AI) will helped or doomed humanity. So, let’s talk about it. Rather than explaining about the history of AI that only a few people cares, let’s talk…
A Brief Intro Have you ever thought of how to get postgresql query result from remote server to our local machine? If so, this short post might be for you. How? Before we start, please keep in mind that there are other methods to get postgresql query result from remote server to local machine, the method that i mentioned after this is the easier method for me. Alright, let’s get to it!
A Brief Intro Have you ever wondering, rather than show the data, can we show the true or false if the data exist or not? If so, then this short post might be for you! How? In this post we will take a look at exists postgresql function. Before we start, please keep in mind that exists use subquery, so there is a penalty of subquery here. The exists will evaluate if the subquery return any rows.
A Brief Intro Have you ever wondering how to count all the data and specific data with a certain condition on one query? If so, then this short post might be for you. Let’s get started! How? Let’s say we organize an event and we store the participants data on our postgresql database. Now we want to know all the participants that registered for the event and all the participants that…
A Brief Intro Have you ever wondering the size of our current postgresql database? If so, this short post might be for you. Let’s get started! How? In postgresql, there’s a function called pg_database_size() which computes the total disk space used by the database with specified database name. We can use pg_database_size() like this: SELECTpg_database_size('db-name');The output of…
A Brief Intro Have you ever experience a failed systemd service and already trying to restart using systemctl restart <some-service> but the failed status still there? If so, this short post might be for you! Let’s get started. Reset Failed Status Now, if our systemd service has a failed status, we can try using command: systemctl reset-failed <some-service> to remove the failed status and…
A Brief Intro Let’s say we have a created_at column in our database with data type big integer that has a value with this equation: EXTRACT(EPOCHFROMNOW())*1000 Don’t ask me why the value of created_at like that because i have no idea. Now, the goals is to count every data per week. How? How to do that? Because we use a unix timestamp which look like this 1687746597339, we need to…
A Brief Intro Have you ever wondering how to update multiple rows with one query? Let’s say you want to change value on table A where the name is anu on year 2019, 2020, and 2021. Rather than doing 3 query with different WHERE statement, we can do that with one query. Without further ado, let’s go straight to it! FROM statement Postgresql has FROM clause in UPDATE statement which let…
A Brief Intro The USING clause on DELETE statement is basically let us join multiple table and delete only the data from those join. If you ever use mysql DELETE JOIN with INNER JOIN, then postgresql USING is kind of similar to that except it can only delete from one table by default. How? How to do that? Here’s an example: Let’s say we have table A and table B which is referenced to…
A Brief Intro Have you ever feel that you have too much docker container from spin up a bunch of docker-compose.yaml file? And when you want to take down all those docker container from the docker-compose.yml, you already delete the file? If that’s the case, then this post might be for you. Before we start, we will be using docker compose version 2.16.0 in this post. If you are using the…
A Brief Intro So recently, around the time i wrote this post, i need to flash my mechanical keyboard. The harsh thing is that, the GUI QMK toolbox only available on windows and macOS, meanwhile i use linux. So, i need to use the QMK CLI to flash my mechanical keyboard. This post is some kind of notes for my future self. “Humans live by forgetting”, some people said. Without further…
A Brief Intro In this post, we will talk about how to remove specific line in vim. We will be using this javascript snippet code as an example: const app = require('./jest-example'); const math = require('./math'); describe('app operation', () => { const multiplyMock = jest.spyOn(math, 'multiply'); multiplyMock.mockReturnValue('itu'); test('call math.add()', () => { const add = jest.spyOn(math,…
Have you ever feels like deleting all the untracked file or directory in git repository is such a pain? If you do, then this post might be for you! Ok, first thing first, there is a git command clean which help us delete the untracked file. We can even use it with interactive interface. To invoke the interactive interface, we can use this command: git clean -i . What that command does is prompt us…
Main Course Let’s say we have an output from xrandr --listactivemonitor like this: Monitors: 2 0: +*eDP-1 1920/344x1080/194+1920+0 eDP-1 1: +HDMI-2 1920/480x1080/270+0+0 HDMI-2 Now, we want to display only the second row which is this line: 0: +*eDP-1 1920/344x1080/194+1920+0 eDP-1 We can do that using awk with this command: xrandr --listactivemonitor | awk 'NR==2' or using process…
A Brief Intro This is all started when i’m trying to make a shell alias using fzf and git add -p command. And i was surprised that the interactive selection from git add -p immediately terminated before i can even press any key. Let’s get started, shall we? First Attempt My first attempt to make that shell alias was something like this: alias gap='git status -s | awk '{print \$2}' |…
A Brief Intro Sometime ago, someone posted a tweet about a replacement for rm -rf $HOME/directory that is mv $HOME/directory /dev/null. When i took a look of it, using the ls -l /dev/null command, i found something like this: crw-rw-rw- 1 root root 1, 3 Jun 11 04:21 /dev/null Now, what is c in the crw below crw-rw-rw- 1 root root 1, 3 Jun 11 04:21 /dev/null After going around on internet, i found…
We don’t have to install vim plugin to get a statusline if we don’t want to. Introduction Hi everyone! In this post I will talk about making your custom statusline in vim. There are a lot of plugins out there that makes vim statusline way better and works out of the box. “Why would someone going through all the trouble while there’s a plugin for that?”, you might ask.
Have you ever want a terminal emulator in google colab instead of jupyter notebook? Well, here it is bois! Skip-able Part First thing first, i prefer to use vim/neovim instead of jupyter notebook and that’s why i prefer to use terminal or terminal emulator to do things as much as possible. I know jupyter notebook has it’s own vim emulation, but it’s not as good as the OG…
This is a continuation from my previous post (you can check it here ). Long story short, this is a minimalist way to manage your python virtual environment. All you need is python and git. What Is Pyv? Here’s a brief intro to what is pyv: Pyv is a simple shell function that let you manage python virtual environment that decoupled from project directory. To put it simply, pyv move the virtual…
If you’re the type of person who like to place all your source code in one file, then this article is not for you. But, if you’re the type of person who like to split up your source code into a few sub-modules, then this article is for you. Skip-able Part When i look at my vimrc (vimrc is a vim config file for those who don’t know), i always feel confused where should i add new…