Skip to content

Instantly share code, notes, and snippets.

View swapnildroid's full-sized avatar
🎯
Focusing

Swapnil Khare swapnildroid

🎯
Focusing
  • Bengaluru, India
  • 04:06 (UTC +05:30)
View GitHub Profile
@swapnildroid
swapnildroid / RangeProportionGateRangeExample
Created May 10, 2023 11:04
Range Conversion Java Kotlin Example
/**
*
* @param x
* @param inMin
* @param inMax
* @param outMin
* @param outMax
* @return
*/
private long normalize(long x, long inMin, long inMax, long outMin, long outMax) {
@swapnildroid
swapnildroid / SpeakBatteryStatus.py
Created September 24, 2022 11:32
Speak battery status on Linux (ubuntu/Lubuntu), requires vlc, text to speech, input timeout python libs.
import subprocess, time, vlc
from gtts import gTTS
from inputimeout import inputimeout, TimeoutOccurred
print("Hello, world!\n")
# upower -i /org/freedesktop/UPower/devices/battery_BAT1
language = 'en'
playLines = ""
exitPromptEmpty = ""
@swapnildroid
swapnildroid / EasyPref.java
Last active October 12, 2016 01:22
Easy way to add/remove Android preferences.
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
public enum EasyPref {
AString,
ABoolean,
AInt,