Skip to content

Instantly share code, notes, and snippets.

View dipendra-sharma's full-sized avatar

Dipendra Sharma dipendra-sharma

View GitHub Profile
@dipendra-sharma
dipendra-sharma / nav_mode.sh
Created April 1, 2026 12:24
Switch Android navigation mode (3-button / 2-button / gesture) via ADB overlay commands — works on Xiaomi and other OEM devices
#!/bin/bash
# Switch Android navigation mode on Xiaomi (and other overlay-based devices)
# Usage: ./scripts/nav_mode.sh [0|1|2]
# 0 = 3-button navigation (back / home / recents)
# 1 = 2-button navigation (back + pill)
# 2 = gesture navigation (pill only, swipe-based)
MODE=${1:-""}
usage() {
@dipendra-sharma
dipendra-sharma / app_scaffold.dart
Created April 1, 2026 12:24
Flutter AppScaffold — transparent status bar + nav bar with correct icon brightness on iOS and all Android navigation modes
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// Drop-in replacement for [Scaffold] that enforces:
/// - Transparent status bar (never takes AppBar background color)
/// - Transparent system navigation bar on Android with correct icon brightness
/// - Correct status bar icon brightness on both iOS and Android
/// - Body extends behind bottom navigation bar (use [EdgePaddedListView]
/// inside body to ensure list content is not hidden)
class AppScaffold extends StatelessWidget {
@dipendra-sharma
dipendra-sharma / BatteryOptimizationUtil.java
Created January 5, 2026 10:40 — forked from moopat/BatteryOptimizationUtil.java
Many Android manufacturers cause trouble by implementing battery optimizations that cause apps to behave unexpectedly at runtime. This util class allows you to show a dialog to users having such phones and sends them to the settings screen where they can turn of battery optimizations for your app.
/*
* MIT License
*
* Copyright (c) 2018 Markus Deutsch
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@dipendra-sharma
dipendra-sharma / CurlLoggingInterceptor.kt
Last active September 16, 2025 08:16
Android OkHttp Interceptor: Auto-Generate cURL Commands for API Debugging
package com.apnamart.apnaconsumer.core_app_framework.retrofit
import android.util.Log
import okhttp3.Interceptor
import okhttp3.Response
import okio.Buffer
import java.io.IOException
class CurlLoggingInterceptor(private val tag: String = "AppLogger") : Interceptor {
@dipendra-sharma
dipendra-sharma / worktree.md
Created July 9, 2025 09:10
A Claude command that creates git worktrees in adjacent directories and automatically launches a new terminal session with Claude running. Perfect for quickly setting up isolated workspaces for different branches while maintaining your current work context.
allowed-tools Bash(git:*), Bash(mkdir:*), Bash(open:*), Bash(gnome-terminal:*), Bash(xterm:*), Bash(konsole:*)
description Create git worktree in adjacent directory and open terminal with claude

Git Worktree Creator

Creates a git worktree in an adjacent directory structure and opens a new terminal with claude running.

Current Repository Info

Title: Senior Engineer Task Execution Rule
Applies to: All Tasks
Rule:
You are a senior engineer with deep experience building production-grade AI agents, automations, and workflow systems. Every task you execute must follow this procedure without exception:
1.Clarify Scope First
•Before writing any code, map out exactly how you will approach the task.
•Confirm your interpretation of the objective.
@dipendra-sharma
dipendra-sharma / config
Created June 14, 2025 12:05 — forked from adibhanna/config
Ghostty config
font-family = BerkeleyMono Nerd Font
#font-family = Iosevka Nerd Font
# font-family = SFMono Nerd Font
font-size = 20
theme = GruvboxDarkHard
shell-integration-features = no-cursor,sudo,no-title
cursor-style = block
adjust-cell-height = 35%
# background-opacity = 0.96
@dipendra-sharma
dipendra-sharma / number_to_indian_words_hindi.py
Created April 21, 2025 18:04
A Python function/script that takes a numerical input and returns its representation in Hindi words (Devanagari script), following the Indian place value system (e.g., लाख, करोड़).
# Complete mapping for 0-99 in Hindi
hindi_numbers_0_99 = [
'शून्य', 'एक', 'दो', 'तीन', 'चार', 'पाँच', 'छह', 'सात', 'आठ', 'नौ',
'दस', 'ग्यारह', 'बारह', 'तेरह', 'चौदह', 'पंद्रह', 'सोलह', 'सत्रह', 'अठारह', 'उन्नीस',
'बीस', 'इक्कीस', 'बाईस', 'तेईस', 'चौबीस', 'पच्चीस', 'छब्बीस', 'सत्ताईस', 'अट्ठाईस', 'उनतीस',
'तीस', 'इकतीस', 'बत्तीस', 'तैंतीस', 'चौंतीस', 'पैंतीस', 'छत्तीस', 'सैंतीस', 'अड़तीस', 'उनतालीस',
'चालीस', 'इकतालीस', 'बयालीस', 'तैंतालीस', 'चवालीस', 'पैंतालीस', 'छियालीस', 'सैंतालीस', 'अड़तालीस', 'उनचास',
'पचास', 'इक्यावन', 'बावन', 'तिरेपन', 'चौवन', 'पचपन', 'छप्पन', 'सत्तावन', 'अट्ठावन', 'उनसठ',
'साठ', 'इकसठ', 'बासठ', 'तिरसठ', 'चौंसठ', 'पैंसठ', 'छियासठ', 'सड़सठ', 'अड़सठ', 'उनहत्तर',
'सत्तर', 'इकहत्तर', 'बहत्तर', 'तिहत्तर', 'चौहत्तर', 'पचहत्तर', 'छिहत्तर', 'सत्तहत्तर', 'अठहत्तर', 'उन्यासी',
@dipendra-sharma
dipendra-sharma / code-editor-rules.md
Created April 9, 2025 16:27 — forked from yifanzz/code-editor-rules.md
EP12 - The One File to Rule Them All

[Project Name]

Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.

Project Context

[Brief description ]

  • [more description]
  • [more description]
  • [more description]
@dipendra-sharma
dipendra-sharma / SudokuSolver.kt
Created April 5, 2025 12:12
SudokuSolver in kotlin
class SudokuSolver(private val board: Array<IntArray>) {
fun solve(): Boolean {
val emptyCell = findEmptyCell() ?: return true
for (number in 1..9) {
if (isValid(emptyCell.first, emptyCell.second, number)) {
board[emptyCell.first][emptyCell.second] = number
if (solve()) {