Skip to content

Instantly share code, notes, and snippets.

View sahildev001's full-sized avatar
🎯
Focusing

sahil kumar sahildev001

🎯
Focusing
View GitHub Profile
@sahildev001
sahildev001 / PY0101EN-1-1-Types.ipynb
Created September 7, 2020 16:27
Created on Skills Network Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sahildev001
sahildev001 / PY0101EN-1-2-Strings.ipynb
Created September 7, 2020 17:21
Created on Skills Network Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sahildev001
sahildev001 / country code list.txt
Last active March 29, 2023 12:53
kotlin country code arrylist java country code array list
countries.add(Country("af", "+93", "Afghanistan"))
countries.add(Country("al", "+355", "Albania"))
countries.add(Country("dz", "+213", "Algeria"))
countries.add(Country("ad", "+376", "Andorra"))
countries.add(Country("ao", "+244", "Angola"))
countries.add(Country("ai", "+1", "Anguilla"))
countries.add(Country("aq", "+672", "Antarctica"))
countries.add(Country("ag", "+1", "Antigua and Barbuda"))
countries.add(Country("ar", "+54", "Argentina"))
countries.add(Country("am", "+374", "Armenia"))
@sahildev001
sahildev001 / drawable_to_uri.md
Created June 16, 2022 10:08
get image uri from drawable android
private fun changedrawabletoUri(resourceId :Int):Uri{
        val imageUri = (Uri.Builder())
                .scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
            .authority(resources.getResourcePackageName(resourceId))
            .appendPath(resources.getResourceTypeName(resourceId))
            .appendPath(resources.getResourceEntryName(resourceId))
            .build()
        return imageUri
 }
@sahildev001
sahildev001 / remove_spaces_from_file_name.sh
Last active March 29, 2023 13:04
Shell script for remove whitespace from file name
find . -depth -name '* *' | while read fname
do
new_fname=`echo $fname | tr " " "_"`
if [ -e $new_fname ]
then
echo "File $new_fname already exists. Not replacing $fname"
else
@sahildev001
sahildev001 / lowercase_file_name.sh
Created August 13, 2022 04:23
convert file names from uppercase to lowecase
#!/bin/sh
# lowerit
# convert all file names in the current directory to lower case
# only operates on plain files--does not change the name of directories
# will ask for verification before overwriting an existing file
for x in `ls`
do
if [ ! -f $x ]; then
continue
fi
@sahildev001
sahildev001 / shortestpath.dart
Created March 29, 2023 11:14
Implement Shortest path from map markers positions and short orders
class Order {
String? uid;
String? orderNo;
String? email;
String? phoneNumber;
String? firstName;
String? lastName;
String? numberOfAdults;
String? numberOfChildren;
String? table;
@sahildev001
sahildev001 / CreateListFileFromDirectory.kt
Created March 29, 2023 11:21
Kotlin function to make list from directory files
fun listFilesInDirectory(directoryPath: String): List<File> {
val directory = File(directoryPath)
return directory.listFiles()?.toList() ?: emptyList()
}
//--- Implement Read text from file
fun readTextFromFile(filePath: String): String? {
val file = File(filePath)
if (!file.exists() || !file.isFile) {
return null