RSSAmplifier

Blog

/dev/null

Recent content on /dev/null

bruhtus.github.ioRSS feed ↗64 posts

Latest posts

Linux Kernel Mentorship Journey

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…

Disable Memory Address Randomization for Shell

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:

Alternative to strcpy() and strncpy() in C

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…

Initialize Struct to Zero in C

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…

Shell Redirection Order

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…

Pointer to Array in C: Compression File Analogy

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&rsquo;s any sort of compression when we use pointer to array. &arr vs &arr[0] In case you didn&rsquo;t know, we can get the address of an array using the address-of operator like &array. Here&rsquo;s an example: #include <stdio.h> int main(void) {…

Lvalue in C

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…

Shell Redirection and Process Substitution Combination

A Brief Intro Recently i watch &ldquo;Bread on Penguins&rdquo; 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&rsquo;t think about previously. Shell…

Square Bracket as Dereference Operator in C

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&rsquo;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&rsquo;s 0, 1, 2, 3, 4). But in C programming language, array can…

Artificial Intelligence: Replacement Point of View

When we talk about something that have &ldquo;artificial&rdquo; in it, we tend to associate that with something that &ldquo;does not exist naturally&rdquo;. 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…

Instanity: Insanity in Instant Culture

At the time of writing this post, there&rsquo;s some sort of AI hype going around, and some of the testimonies is that AI make people &ldquo;learn faster&rdquo; or &ldquo;doing stuff faster&rdquo;. With that in mind, let&rsquo;s talk about how this mentality can be bad. First off, some people want to &ldquo;learn faster&rdquo;, and i&rsquo;m like and then what? What would these people do after…

Competing on the Worst Experience

Recently i watched Dr. K&rsquo;s video on youtube . He talks about &ldquo;why &lsquo;the grind&rsquo; isn&rsquo;t meant for everyone&rdquo; 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&rsquo;s not the end of it. If you ever talk to a friend and said &ldquo;i have a lot of tasks at work&rdquo; and then…

Human's Inconsistency and Artificial Intelligence

At the time of writing blog post, human still trying to emulate human&rsquo;s intelligence on machine. This concept usually called Artificial Intelligence. This attempt has gone for quite sometime, there&rsquo;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…

Programmer is Designer

Recently i finished reading Peter Naur&rsquo;s essay called Programming as Theory Building and i think that essay describe what i like about programming, that is &ldquo;building a theory&rdquo; or i usually called it &ldquo;designing a system&rdquo;. I like to think of myself as &ldquo;designer&rdquo; when i&rsquo;m programming, because in a way, i&rsquo;m basically designing some sort of…

Witch Allegation in AI Dystopia

Recently i found someone&rsquo;s status about &ldquo;getting accused of using AI when we didn&rsquo;t&rdquo;, so let&rsquo;s talk about it. Here&rsquo;s the status, in case anyone curious: Before we start, i just want to say that the term AI in here means &ldquo;Artificial Intelligence&rdquo;, not &ldquo;Another Idiot&rdquo; or &ldquo;Actual Indian&rdquo;. With that in mind, let&rsquo;s get…

To Be Open

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&rsquo;s exactly what i am trying to achieve, which is &ldquo;to be open&rdquo;. It&rsquo;s not only about the source code, it&rsquo;s about being human. Nowadays i feel like there is some kind of pressure &ldquo;to be perfect&rdquo;, &ldquo;to have no mistake&rdquo;,…

Pointer in C: Warehouse Analogy

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 &ldquo;pointer&rdquo;. I know that there&rsquo;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&rsquo;s a company called RAM…

Difference Between i++ and ++i in C

A Brief Explanation Let&rsquo;s say we have int i = 0;, and imagine there&rsquo;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:

Become the Unofficial Leader

Recently i read about Simon Sinek&rsquo;s post about would you still lead if no one ever knew your name? and my answer to those question is a solid &ldquo;yes&rdquo;. Here&rsquo;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…

Psql Copy Functionality

A Brief Intro I need to replace data on one database server with data on another database server. Let&rsquo;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&rsquo;s how i understand it). With that in mind, i&rsquo;m trying…

Postgresql Update Multiple Rows With Unnest Function

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&rsquo;t really want…

Flashing Skeletyl Keyboard With Miryoku Layout

Setup Miryoku in QMK Disclaimer: By the time of writing this post, there&rsquo;s a breaking change in QMK that remove user keymaps, including miryoku. And miryoku QMK haven&rsquo;t porting it&rsquo;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.…

Golang Simple Query Composer With Text Template and Pgx

For backend development at work, we just transitioned from Node.js to golang recently. We use pgx as our PostgreSQL driver. I&rsquo;m not quite sure why we choose pgx as our PostgreSQL driver and not using ORM like gorm, so we won&rsquo;t talk about that here. My principal is to adapt to the tech stack that the project use rather than forcing what i&rsquo;m familiar with, so i don&rsquo;t really…

Configure Vim as Intro to Software Design

As vim gaining popularity these days, I&rsquo;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&rsquo;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,…

Git Rebase Chained Branch

Let&rsquo;s say we try to develop a feature B, but those feature need feature A which haven&rsquo;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…

Use Arch Linux VM for Linux Kernel Testing

A Brief Intro Have you wondered &ldquo;how can we test a linux kernel without breaking our linux operating system installation?&rdquo;. One of the method is using virtual machine (VM) and in this post we&rsquo;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…

Install Arch Linux on Virtual Machine

A Brief Intro In this post, we&rsquo;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…

Unintegrated Development Environment

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 &ldquo;why not having a development environment without integration at all?&rdquo;. This might sound crazy for some people, but this is my development environment at the time of…

Reflecting on Intelligence

Over the years i&rsquo;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…

Manage Dotfiles With Git Working Repository

A Brief Intro For those who read this article without knowing what dotfiles are, it&rsquo;s basically a configuration files. The purpose of backing up dotfiles is so that we don&rsquo;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…

The Time Artificial Intelligence Take Over Humanity

One evening i read an article about if bill gates could ask a time traveller, he&rsquo;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&rsquo;s talk about it. Rather than explaining about the history of AI that only a few people cares, let&rsquo;s talk…

Postgresql Export Query Result From Remote to Local in CSV file

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&rsquo;s get to it!

Postgresql Exist Clause

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.

Postgresql Count Data on Different Condition in The Same Query

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&rsquo;s get started! How? Let&rsquo;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…

Postgresql Get Current Database Size

A Brief Intro Have you ever wondering the size of our current postgresql database? If so, this short post might be for you. Let&rsquo;s get started! How? In postgresql, there&rsquo;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…

Systemd Reset Failed Status

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&rsquo;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…

Postgresql Count Weekly With Bigint Data Type

A Brief Intro Let&rsquo;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&rsquo;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…

Postgresql Update Multiple Rows with One Query

A Brief Intro Have you ever wondering how to update multiple rows with one query? Let&rsquo;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&rsquo;s go straight to it! FROM statement Postgresql has FROM clause in UPDATE statement which let…

Postgresql's USING Clause on DELETE Statement

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&rsquo;s an example: Let&rsquo;s say we have table A and table B which is referenced to…

Docker Compose Down Without Yaml File

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&rsquo;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…

Simple Guide Flashing Mechanical Keyboard with QMK CLI

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. &ldquo;Humans live by forgetting&rdquo;, some people said. Without further…

Remove Specific Line in Vim

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,…

Clean Up Untracked File in Git Repo

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…

Awk Print Row Instead of Column

Main Course Let&rsquo;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…

Shell Process Substitution as Temp File

A Brief Intro This is all started when i&rsquo;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&rsquo;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}' |…

Replacement For Info Command

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…

Guide to Make Your Own Vim/Neovim Statusline

We don&rsquo;t have to install vim plugin to get a statusline if we don&rsquo;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. &ldquo;Why would someone going through all the trouble while there&rsquo;s a plugin for that?&rdquo;, you might ask.

Access Google Colab Through SSH and SSHFS

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&rsquo;s why i prefer to use terminal or terminal emulator to do things as much as possible. I know jupyter notebook has it&rsquo;s own vim emulation, but it&rsquo;s not as good as the OG…

Pyv: Minimalist Python Venv Management Tool

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&rsquo;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…

Split Up Vimrc

If you&rsquo;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&rsquo;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&rsquo;t know), i always feel confused where should i add new…