Skip to content

Instantly share code, notes, and snippets.

@SatyaSnehith
SatyaSnehith / gist:54cf4ce68d3e4afc0febb31db3d8a1ef
Created June 20, 2024 15:44
automatic creation of fonts values in compose
fun printFont() {
for (fontWeight in listOf(
"Thin",
"Light",
"Normal",
"Medium",
"Bold",
"Black"
)) {
for (fontSize in 12..24) {
@SatyaSnehith
SatyaSnehith / TwitterDatePicker.kt
Last active May 22, 2024 16:00 — forked from bagus2x/TwitterDatePicker.kt
Jetpack compose twitter date picker (dob). Jetpack Compose scrollable date picker.
package com.satyasnehith.wpd
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.pager.VerticalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material3.MaterialTheme
@SatyaSnehith
SatyaSnehith / size_converter.c
Last active June 17, 2023 19:13
Convert Bytes to KB, MB, GB, TB, PB, EB- C
// execution
// gcc size_converter.c -o size_converter && ./size_converter 512
#include<stdio.h>
#include<stdlib.h>
typedef unsigned long long ULL;
char *types[] = {"Bytes", "KB", "MB", "GB", "TB", "PB", "EB"};
@SatyaSnehith
SatyaSnehith / HasNull.kt
Created March 21, 2022 10:57
if any one of the variables has null return true
fun hasNull(vararg list: Any?) = null in list
@SatyaSnehith
SatyaSnehith / App.js
Last active May 7, 2021 12:14
Doughnut chart in react native
import React, {Component, useState} from 'react';
import {View, TouchableWithoutFeedback, StyleSheet, Animated, Easing} from 'react-native';
import Svg, {Path} from 'react-native-svg';
function getPos(x, y, radius, angle) {
let radians = (angle + 90.0) * Math.PI / 180.0;
return {
x: (radius * Math.sin(radians)) + x,
y: (radius * Math.cos(radians)) + y
};
@SatyaSnehith
SatyaSnehith / MainActivity.java
Last active April 19, 2021 18:41
Progress Bar with drawable in Andorid
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@SatyaSnehith
SatyaSnehith / colors.xml
Created April 1, 2021 11:34
Material colors for android studio
<color name="red_50">#ffebee</color>
<color name="red_100">#ffcdd2</color>
<color name="red_200">#ef9a9a</color>
<color name="red_300">#e57373</color>
<color name="red_400">#ef5350</color>
<color name="red_500">#f44336</color>
<color name="red_600">#e53935</color>
<color name="red_700">#d32f2f</color>
<color name="red_800">#c62828</color>
<color name="red_900">#b71c1c</color>
@SatyaSnehith
SatyaSnehith / ExecutionTimer.java
Created February 4, 2021 14:40
find out the execution time of a block of code or whole program
public class ExecutionTimer {
private static long startTime;
static {
startTime = -1;
}
public static void startTimer() {
startTime = System.currentTimeMillis();
}
@SatyaSnehith
SatyaSnehith / address-book.txt
Created May 17, 2020 08:33
Mac Prefix Vendor Name
This file has been truncated, but you can view the full file.
000000 XEROX CORPORATION
000001 XEROX CORPORATION
000002 XEROX CORPORATION
000003 XEROX CORPORATION
000004 XEROX CORPORATION
000005 XEROX CORPORATION
000006 XEROX CORPORATION
000007 XEROX CORPORATION
000008 XEROX CORPORATION
000009 XEROX CORPORATION
@SatyaSnehith
SatyaSnehith / ListFile.java
Last active May 4, 2020 11:26
Get organization name from mac address prefix. compile and run "java ListFile <mac address prefix(multiple)>. file:https://drive.google.com/file/d/16a1oCASZcM6NUU7t2dVKYFYi4D9_kvKY/view?usp=sharing
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
public class ListFile {
String fileName = "address_book.txt";
List<String> list;
ListFile() {