Skip to content

Instantly share code, notes, and snippets.

@shakir915
shakir915 / My.java
Created June 21, 2024 08:15
My.java
package proto;// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: my.proto
public final class My {
private My() {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
@shakir915
shakir915 / YahooSocketFetcher.kt
Last active June 21, 2024 08:16
YahooSocketFetcher
package shakir.bhav.common
import com.google.common.primitives.Ints
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import okhttp3.*
import proto.My // proto file : https://gist.github.com/shakir915/f2f078058183a5beb4a853d7d6529de4
import java.io.File
import java.io.FileOutputStream
import java.text.SimpleDateFormat
@shakir915
shakir915 / gist:72165e712c11c9b15e16a60b281f6940
Last active February 9, 2024 12:41
flutter canvas draw a ring with innerRadius and outerRadius
double centerX = positioned.dx;
double centerY = positioned.dy;
// Inner and outer radii
double innerRadius =radius;
double outerRadius = 500+ ((1 - progress) *500);
Paint ringPaint = Paint()
..color = colorShadow.withOpacity(opacityShadow) // Color for the ring
..style = PaintingStyle.stroke
@shakir915
shakir915 / drop Shadow compose
Last active January 30, 2024 11:29
dropShadow.kt
import android.graphics.BlurMaskFilter
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Paint
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@shakir915
shakir915 / aesEncryptDecrypt.kts
Created December 5, 2023 05:16
aes Encrypt Decrypt
@file:OptIn(ExperimentalEncodingApi::class)
import javax.crypto.Cipher
import javax.crypto.spec.SecretKeySpec
import kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi
@OptIn(ExperimentalEncodingApi::class)
fun decrptAES(cipherText: String?): String {
import java.io.File
import java.io.IOException
import java.util.concurrent.TimeUnit
fun travers(file: File) {
file.listFiles().forEach {
if (it.isDirectory) {
travers(it)
} else {
@shakir915
shakir915 / PlatformFileWriter.kt
Last active November 21, 2023 20:01
file io in IOS kotlin native KMM / compose multiplatform file read write in ios
// file io in IOS kotlin native KMM / compose multiplatform file read write in ios
//common main
expect class PlatformFileWriter() {
fun read(filename: String): String?
fun save(filename: String, content: String)
fun append(filename: String, content: String)
}
@shakir915
shakir915 / CSVToJsonWithUnderScoreNames.kts
Created October 18, 2023 07:33
google sheet exported CSV to Json for String/ Text/ Locale in flutter/ apps
/****
google sheet exported CSV to Json for String/ Text/ Locale in flutter/ apps
run this kotlin script file
UNTICK : Interactive Mode
TICK: Use REPL
edit source path (check code)
run in Android studio scratch file
* */
@shakir915
shakir915 / FlutterEdgInsetReplacerForRTL.kts
Last active October 17, 2023 09:52
Flutter EdgeInset replace with EdgeInsetsDirectional
/****
Flutter EdgeInset replace with EdgeInsetsDirectional
run this kotlin script file
UNTICK : Interactive Mode
TICK: Use REPL
edit folder path in "dir" (check code)
run in Android studio scratch file
* */
@shakir915
shakir915 / trim end zeros.kt
Last active April 27, 2023 11:04
trim end zeros
import java.util.*
var array= arrayOf(
1.00,
1.01,
1.11,
1.10,
1.00111,
1.01111,
1.11111,
1.10111,