Skip to content

Instantly share code, notes, and snippets.

View tysonpaul89's full-sized avatar

Tyson Paul tysonpaul89

  • Kochi, Kerala, India
View GitHub Profile
@tysonpaul89
tysonpaul89 / go_aws_util.go
Created October 9, 2024 11:31
Go lang AWS SDK Wrapper Package
// 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"
@tysonpaul89
tysonpaul89 / common_name_filed_case_validation.py
Last active December 28, 2021 08:33
Serializer base class to implement common name validation for the child serializers.
# ===== 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)
@tysonpaul89
tysonpaul89 / django_orm_tips_sub_query.py
Last active February 9, 2022 13:26
Some Tips on Django ORM
# 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', ...)
@tysonpaul89
tysonpaul89 / go_cheatsheet.md
Last active November 3, 2024 04:54
Go Cheatsheet

Go

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

Topics

@tysonpaul89
tysonpaul89 / rust_notes.md
Created October 12, 2020 03:56
Rust Notes

Intro to Rust programming language

Installation and Execution

Linux

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

others operating systems use this link

Creating a new project

Cargo is the package manager for the rust. A rust uses cargo create a project.

@tysonpaul89
tysonpaul89 / docker_cheat_sheet.md
Created October 12, 2020 03:52
Docker Cheat Sheet

Docker Cheat Sheet

To list all running containers

$ docker ps

To list all running and stopped containers

$ docker ps -a

To see advanced settings of a container