Skip to content

Instantly share code, notes, and snippets.

View KaustubhPatange's full-sized avatar
🎯
Focusing

Kaustubh Patange KaustubhPatange

🎯
Focusing
View GitHub Profile
@KaustubhPatange
KaustubhPatange / clean-proj.ps1
Created April 3, 2020 09:55
An utility to clean temp files in project.
# Created by Kaustubh Patange
# Date Modified: 3rd April 2020
#
# @Platform: Windows (only) - A Powershell script
#
# @Summary: We often get into some space issues during coding, especially when you are
# doing Android development (native) in Android Studio which exceptionally
# creates larger gradle downloads and stuff. This is applicable also for
# flutter, Xamarin or even a standard .Net project, etc.
#
@KaustubhPatange
KaustubhPatange / publish.gradle
Last active February 5, 2021 05:04
A Gradle script to automatically publish Android library to maven or sonatype provided your central sync is enabled.
/*
* Copyright 2020 Kaustubh Patange
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@KaustubhPatange
KaustubhPatange / library.kt
Last active December 26, 2020 14:35
Mapping a data class to another data class typically found in the apps which follows clean architecture (domain, etc.)
/**
* If there is two same classes like below one maybe domain & other may be entity
* Following method might help to map such instance to other classes.
*
* This is done completely through reflection by matching parameters name.
*
* [convertType] This can be used to transform intermediate values if their types are different in other.
*/
inline fun <reified F : Any, reified T : Any> mapToClass(from: F, convertType: (String, Any?) -> Any? = { _,v -> v }): T {
val args = HashMap<KParameter, Any?>()
@KaustubhPatange
KaustubhPatange / ActivityResultExtensions.kt
Created February 23, 2022 11:11
Some extension methods to use ActivityResult API in a callback way.
package com.kpstv.xclipper.extensions
import android.content.Intent
import androidx.activity.ComponentActivity
import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContract
import androidx.activity.result.contract.ActivityResultContracts
import androidx.fragment.app.Fragment
import java.util.*
@KaustubhPatange
KaustubhPatange / slack_dm_delete.py
Created October 1, 2023 09:38
A script to recursively delete Slack DM's messages and replies.
# A script to recursively delete Slack DM's messages and replies.
#
# Preparation:
# - Create a slack app and install it in your workspace or any channel
# - In OAuth & Permissions, add channels:read, chat:write, groups:read, im:read, incoming-webhook, mpim:read, users:read
# scopes to both Bot and User Token scopes, you might need to reinstall it in the workspace.
# - Get "User OAuth Token".
# - pip install requests==2.28.1 termcolor
@KaustubhPatange
KaustubhPatange / slack_channel_delete.py
Created October 1, 2023 09:43
A script to recursively delete Slack channel's messages and replies posted by you.
# A script to recursively delete Slack channel's messages and replies posted by you.
#
# Preparation:
# - Create a slack app and install it in your workspace or any channel
# - In OAuth & Permissions, add channels:read, chat:write, groups:read, im:read, incoming-webhook, mpim:read, users:read
# scopes to both Bot and User Token scopes, you might need to reinstall it in the workspace.
# - Get "User OAuth Token".
# - pip install requests==2.28.1 termcolor
import time
source ~/.vimrc
" Causes problems with some mappings
"source ~/.ideavimrc
remap <SPACE> <Nop>
let mapleader="\<Space>"
""" runtime/defaults.vim
set history=200
set showcmd