$ docker ps
$ docker ps -a
Linux
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
others operating systems use this link
Cargo is the package manager for the rust. A rust uses cargo create a project.
Go is a statically typed, compiled programming language designed at Google. Go is syntactically similar to C, but with memory safety, garbage collection, structural typing, and CSP-style concurrency.
This cheat sheet is prepared by refering the book Introducing Go Build Reliable, Scalable Programs by Caleb Doxsey
| # Django ORM Tips: | |
| # When you have do an SQL"IN" operation, we generally do it like this. ie, convert the results to a list. | |
| # DON'T DO THIS | |
| seasons = list(Season.objects.values_list('name', flat=True)) | |
| result = Crops.objects.filter(season__name__in=seasons) | |
| print(result) | |
| # The above ORM query will generate the following SQL command: | |
| # SELECT * FROM crops c inner join season s on c.season_id = s.id where s.name in ('winter', 'summer', ...) |
| # ===== Models ===== | |
| class Country(models.Model): | |
| name = models.CharField(max_length=150, unique=True) | |
| class Molecule(models.Model): | |
| name = models.CharField(max_length=150, unique=True) | |
| class TherapeuticCategory(models.Model): | |
| name = models.CharField(max_length=150, unique=True) |
| // AWS SDK wrapper package | |
| package aws | |
| import ( | |
| "context" | |
| "fmt" | |
| "strings" | |
| "github.com/aws/aws-sdk-go-v2/aws" | |
| "github.com/aws/aws-sdk-go-v2/config" |
The following code will writes both gin's logs and logs from log/slog into a single file. The example also uses lumberjack to implement the log rotation mechanism.
NOTE: When using this configuration the console logs will not show colors
package main
import (