Posts

My ToDo List for 2024 (daily updates)

waffarx cash back

How to store prices efficiently in Laravel Eloquent ?

We can store prices efficiently in Laravel Eloquent by focusing on avoiding floating-point issues and optimizing storage. The appraoch is storing price as integer. Here is how. How to store prices as integer ? 🔗 Define an integer column in your database table to store the price in the smallest denomination of your currency. For example, for USD, store the price in cents (e.g., $10.50 becomes 1050). Use a mutator in your Eloquent model to handle price setting.

Go Language Cheatsheet

Hello world 🔗 create a new directory with a name like hellogo. create a new file inside with the name main.go. add this code inside that main.go file. package main import "fmt" func main() { message := greetMe("world") fmt.Println(message) } func greetMe(name string) string { return "Hello, " + name + "!" } open the directory in a Terminal, and run go mod init hellogo then go mod tidy then build the project with go build main.

All Terminal Emulator Commands for Android

Terminal is a program to use your operating system in a CLI mode. CLI stands for command line interface. Terminal emulator is a program to emulate the terminal on Android smartphones. Here are all the commands for the Android terminal emulator. moving between directories 🔗 command meaning ls list all files and directories inside in the current directory ls /sbin list all files inside /sbin which are the system programs because /sbin is where system programs go cd change directory to home directory cd ~ change directory to home directory cd /system/etc/ change directory (a.

Thoughts of a Web Framework in Go

I am thinking of a web framework in Go programming language. A framework similar to PHP Laravel and Ruby on Rails, but not too similar! We can create Laravel but in Go like what goravel is going to achieve. I think this is not what we want as Go developers! We can build the web app from scratch in Go using libraries/packages step by step, trying two or three libs to choose one for exach functionality/feature.

Google Patches Linux kernel with ~40% TCP performance

I watched a video from Hussein Nasser on YouTube about a patch from Google to get better performance at scale. Coco Li (from Google) explained of their cachline optimization effort to the networking code: “Currently, variable-heavy structs in the networking stack is organized chronologically, logically and sometimes by cache line access. This patch series attempts to reorganize the core networking stack variables to minimize cacheline consumption during the phase of data transfer.

A Complete Guide to Docker | Cheatsheet

What is docker ? 🔗 Docker is a platform for developing, deploying, and running applications in standardized units called containers. These containers package the application’s code, libraries, and dependencies, ensuring it runs consistently across different environments. Think of it like shipping containers for software, making it easier and faster to move your application around without worrying about compatibility issues. Why Docker ? 🔗 Portability: Docker apps run consistently across different environments, from development machines to production servers, avoiding the “it works on my machine” problem.

How to get the stdout of a command into the clipboard on Ubuntu Linux ?

Pre-installed Commandline Tools on Ubuntu 🔗 xsel comes preintalled in Ubuntu Linux. Actually XSEL is pre-installed with XServer if you are using it. You can copy with xsel like this. echo "text to be copied" | xsel -ib Or copy by directing the output of text files like that. xsel -ib < ~/.bashrc You can paste the copied text into the standard output by this command. xsel -ob Or just use the command without any arguments.

How to get the stdout of a command into the clipboard on Mac OS ?

Mac OS Native Commandline Tools 🔗 Mac OS comes with pbcopy to copy text, and pbpaste to paste the previously copied text. You can copy with pbcopy like this. pbcopy < id_bus_ssh_pass.txt or piping the standard output (stdout) into standard input (stdin) of pbcopy. cat id_bus_ssh_pass.txt | pbcopy You can use pbpaste to print out the previously copied text. pbpaste spits out the text into the standard output (stdout). So, you can use it in scripts like this.

How to get a text file from a server I already SSHed into ?

I ssh into my server via this command. sudo ssh -i /Users/mbp/.ssh/authorized_keys/id_bus [email protected] When I click enter, I should write the sudo password. Then I write the password of the SSH key (id_bus). Make sure you use the main domain name of your shared hosting or dedicated VPS. So, I use SCP to download a text file from my server using SSH key identity by this command. sudo scp -i /Users/mbp/.

Software I Use

I share with you all software I use as a software developer. Here is the list of all programs, apps, .. all software products and services. Web Browser 🔗 I use Google Chrome, Google Chrome Dev, Mozilla Firefox, Firefox Developer Edition, Apple Safari, Microsoft Edge and Brave. As a full stack web developer I need to use them all for testing websites. I striked out the web browsers I uninstalled from my main work machine/laptop.