programming

All About My Custom Hugo Theme KMT

My ToDo List for 2024 (daily updates)

waffarx cash back

Useful npm Packages for All Projects

date-fns πŸ”— date-fns (a.k.a Date Functions) is a library which gives you functions to deal with dates. It is great package with a small size. dotenv πŸ”— dotenv create a .env file to store your environment variables. So when you publish that project online you use the environment variables which you deploy the project on. socket.io πŸ”— Help you use the sockets to create realtime communications such as chat apps.

View time taken of last command in Fish shell

Just use $CMD_DURATION to get the time taken running the last command. To make your prompt give you the elapsed time for every command you run in Terminal, add this function in your Fish config file ~/.config/fish/config.fish. function fish_prompt; echo "$CMD_DURATION ο£Ώ "; end The prompt will be like that. I hope this helps you. You know someone will benefit from this, share it with him/her, a friend or colleage.

WebSocket Communication Between Two Go Programs, the Easy Way

This article was written with one idea in mind: to show you, how to make a communication between two Go programs, using WebSockets. The simplest possible way. When using WebSockets, one program has to act as a server. But there can be numerous other programs as clients. In this article we will create one server and one client. WebSocket Server πŸ”— The code for server is pretty simple. And because we don’t want to reinvent the wheel, we will use gobwas module.

Why built-in functions in python are faster ?

Because Python is sitting of the shoulders of giants. Built-in functions are written in C and C++ under the hood. C and C++ languages are efficient and fast, so their functions will be faster than the functions you write in Python. So it is recommended to use built-in functions instead of creating new ones.

Why Did Google Develop Go ?

Google has two tremendous problems. One of them is compile time. Back in the 1980’s, reasonable sized projects took hours to do a clean build. There were whole server farms dedicated to recompiling. You got a new β€œnightly build” and made modifications to that. Google builds things that are so ridiculously huge that it’s still like that in 2017. It takes 5 hours to rebuild chrome from scratch even on a big fat i7 system.

Why Do Command Lines Still Exist ?

GUI (graphical user interface) is easy to use and goodlooking. But CLI (command line interface) is faster and easier to automate. Advantages of Command Line over Graphics πŸ”— Graphics are fancy but lack clarity and prone to errors and crashes and uses alot of resources (RAM, CPU and GPU). Here are some advantages. Lightweight Text Interface πŸ”— If you accomplish a task like converting mp4 to mp3 on command line using ffmpeg , it will be faster than using any other GUI program such as Format Factory (for Windows OS).

Why Do People Use Go ?

People use Go programming language For various reasons. Here is all reasons in brief: Go is open-source but backed up by a large corporation (Google) It’s fast: to learn to build up to compile to arrange and install to scamper Go is a modern language Go is Simple It is Concurrent Static code analysis Garbage collected language Testing Support And now, let’s dive in each reason. Performance πŸ”— Most people come to Go from dynamic languages like Ruby , Python , JavaScript , PHP and similar.

Why Go is better than Rust ?

First, it’s very important to say that both Go and Rust are absolutely excellent programming languages. My goal here is not to criticize any language. In this article, I’ll try to give a brief overview of where I think Rust is the ideal choice, and where I think Go is a better alternative. If you had to sit down and think of the programming languages which were best aligned with the motive to develop secure, microservice favoring frameworks and apps, you would again find yourself staring at the two languages.

Why I recommend Mark Text as a markdown text editor ?

Mark Text is a great markdown text editor. Advantages of Mark Text πŸ”— simple and easy to use Realtime preview (WYSIWYG) : a.k.a seamless writing/editing with distraction-free writing experience fast enough and efficient open source software free of charge. Markdown extensions such as math expressions (KaTeX), front matter and emojis. export as HTML or PDF. support dark mode paste images directly from clipboard (a.k.a you can copy-and-paste an image). edit modes : source code mode, typewriter mode and focus mode.

Why is n++ faster than n=n+1?

The answer is related to the old CISC cpu instructions and the way how C (or any programming language) is compiled to binary code. In almost every CISC CPU there is a special β€œadd” instruction that is named INC (or DEC) and that instruction increments (or decrements) by 1 the value of a register (or memory). If you use another instruction for addition you have to add both operands you want to sum.