Skip to content

Instantly share code, notes, and snippets.

View nisrulz's full-sized avatar
🌌
Coding in the MultiVerse

Nishant Srivastava nisrulz

🌌
Coding in the MultiVerse
View GitHub Profile
@nisrulz
nisrulz / vpn.md
Created September 6, 2023 09:25 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@nisrulz
nisrulz / gist:ecf42b8efde0d0a4f7a95d77fb072a3e
Created October 25, 2022 11:11 — forked from sonvp/gist:7873060a99895f483ca48fdc030c71ad
DrawableLeft to top or DrawableRight to top in TextView multiline.
1. Create Custom TextView.
public class TextViewDrawable extends android.support.v7.widget.AppCompatTextView {
public TextViewDrawable(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
/**
@nisrulz
nisrulz / Utils.kt
Created July 31, 2022 00:23
Check if Internet is available in Android
private fun isInternetAvailable(): Boolean {
return try {
val timeoutMs = 1500
val sock = Socket()
val sockaddr = InetSocketAddress("8.8.8.8", 53)
sock.connect(sockaddr, timeoutMs)
sock.close()
true
@nisrulz
nisrulz / git.sh
Created July 12, 2022 12:08
Create an empty branch and add an empty commit to it.
git switch --orphan <new branch>
git commit --allow-empty -m "Initial commit on orphan branch"
git push -u origin <new branch>
@nisrulz
nisrulz / android-bluetooth-low-energy-resources.md
Created April 26, 2022 21:24 — forked from stkent/android-bluetooth-low-energy-resources.md
Android Bluetooth Low Energy (BLE) Resources
@nisrulz
nisrulz / AndroidEasySetLangCountry
Created February 22, 2022 10:53 — forked from douglasselph/AndroidEasySetLangCountry
The following allows you to very easily flip between languages and country on Android.
The following allows you to very easily flip between languages and country on Android.
This will IMMEDIATELY cause the change without even needing to shut down the target testing app.
(That is, the currently displayed page will reloaded.)
You first need to install this APP on the phone:
https://play.google.com/store/apps/details?id=net.sanapeli.adbchangelanguage&hl=en
Then to flip copy and paste one of the lines below in a terminal.
@nisrulz
nisrulz / Readme.md
Created February 21, 2022 22:57
Find the files where you are using Kotlin Synthetics

Find the files where you are using Kotlin Synthetics

Run this command at the root of your project

grep -rwl . -e 'kotlinx.android.synthetic'
  • -r = Recursive
  • -w = Match the whole word
@nisrulz
nisrulz / Readme.md
Last active February 2, 2022 16:25
Android: Setup system env based signing config

Signing in Android

  • Using ENV vars

Inside your ~/.zshrc or ~/.bashrc file

Note: For CI, declare key-value pair under secrets section

export KEYSTORE_FILE_PATH = "/Users/your_user/App_Directory/keystore_file.keystore"
export KEYSTORE_PASSWORD = "********"
export KEY_ALIAS = "key_alias"
@nisrulz
nisrulz / reset-intellij.sh
Created November 27, 2021 00:16
Reset IntelliJ IDE
#!/usr/bin/env bash
rm -rf ~/Library/Caches/JetBrains/IdeaIC202*
echo Done!
@nisrulz
nisrulz / setup-jdk.sh
Created November 24, 2021 15:49
Install JDK
brew tap mdogan/zulu
brew install --cask zulu-jdk15 zulu-jdk11 zulu-jdk8