Skip to content

Instantly share code, notes, and snippets.

View YektaDev's full-sized avatar
𝐼𝓃 𝓈𝑒𝒶𝓇𝒸𝒽 𝑜𝒻 𝓁𝒾𝑔𝒽𝓉

Ali Khaleqi Yekta YektaDev

𝐼𝓃 𝓈𝑒𝒶𝓇𝒸𝒽 𝑜𝒻 𝓁𝒾𝑔𝒽𝓉
View GitHub Profile
@YektaDev
YektaDev / Shade.kt
Last active June 4, 2021 01:50
All colors of the Material Palette as an enum class.
/*
* Copyright © 2021 Ali Khaleqi Yekta, All Rights Reserved.
*
* Author: Ali Khaleqi Yekta [YektaDev]
* Website: https://Yekta.Dev
* Email: Me@Yekta.Dev
*/
enum class Shade(val hex: Int) {
Red50(0xffebee),
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@JvmInline
@Serializable
value class Username private constructor(@JvmField val value: String) {
companion object {
private const val MIN_LENGTH = 5
private const val MAX_LENGTH = 20
fun getOrNull(value: String): Username? = if (value.isValid()) Username(value) else null
private fun String.isValid(): Boolean {
if (length !in MIN_LENGTH..MAX_LENGTH) return false
@YektaDev
YektaDev / Summary 3, 4, 5 - Computer Networking (A Top-down Approach).md
Last active November 3, 2023 03:48
A partial (and informal!) summary of chapters 3, 4, and 5 of "Computer Networking: A Top-down Approach" by Jim Kurose & Keith W. Ross
"Computer Networking: A Top-down Approach" by Jim Kurose & Keith W. Ross (8th edition)
A Partial (and Informal!) Summary of Chapters 3, 4, and 5
Ali Khaleqi Yekta - Jun 2023

📗 Chapter 3 - Transport Layer

Sockets are in App layer. When they reach Transport layer, it merges (multiplexes) all of them & adds its own header (headers are responsible to find the correct socket).

@YektaDev
YektaDev / cecho
Last active November 22, 2023 12:35
C(olored) Echo
#!/bin/zsh
#
# cecho - A script to echo colored text using tput
# Author: Ali Khaleqi Yekta
#
# Ensure the inputs are provided.
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: cecho <color> <text>"
exit 1
@YektaDev
YektaDev / TerminalExt.kt
Last active March 17, 2024 14:50
A handy set of extensions for quick terminal-based projects.
/*
* QuickTerminalExt.kt - A handy set of extensions for quick terminal-based projects.
* https://gist.github.com/YektaDev/12c0f5a26ad9a86712bfefb252267ef0
* ---
* QuickTerminalExt.kt is licensed under the MIT License.
* ---
* Copyright (c) 2024 Ali Khaleqi Yekta
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal