Skip to content

Instantly share code, notes, and snippets.

Avatar
🔍
curiously exploring the problems and their solutions

Ansh Sachdeva root-ansh

🔍
curiously exploring the problems and their solutions
View GitHub Profile
View code_analysers.gradle
apply plugin: "io.gitlab.arturbosch.detekt" // detekt STEP1 applying plugin (detekt = kotlin code's static analyser)
apply plugin: "checkstyle" // checkstyle STEP1 applying plugin (checkstyle = java code's static analyser)
// detekt STEP2 plugin configuration
detekt {
parallel = true
allRules = true
ignoreFailures = true
debug = true
}
@root-ansh
root-ansh / basic.yaml
Created March 11, 2022 19:07
static code analysers
View basic.yaml
# .github/workflows/basic.yaml
- name: CodeAnalysis via detekt
run: ./gradlew detekt
- name: Upload detekt results
uses: actions/upload-artifact@v2
with:
name: detekt_results
path:app/build/reports/detekt
@root-ansh
root-ansh / build.gradle
Created August 16, 2020 18:07
Securing keys-Medium
View build.gradle
// app/build.gradle
plugins {
...
}
android {
...
defaultConfig {
@root-ansh
root-ansh / installingLAMP_20_4_lts.md
Created May 3, 2020 01:39
Installing lamp on Ubuntu 20.4 LTS
View installingLAMP_20_4_lts.md

(A little complex article, but works very fine after installing LA of LAMP : https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04)
(Easier article : https://www.tecmint.com/install-lamp-with-phpmyadmin-in-ubuntu-18-04/)

Setting up the L:Linux

we are assuming you are on a linux machine. Although it would be good,if you have an ssh with you and have set up the machine to act as server with one of the firewalls.
More details Here

Setting up the A: Apache

@root-ansh
root-ansh / DecodingAndRotationCode.java
Created June 4, 2019 13:36
Delegation to system cam
View DecodingAndRotationCode.java
private static Bitmap getBitmapFromUri(Context context, Uri photoURI) {
// super cool decoding algorithm at https://stackoverflow.com/a/31720143/7500651
try {
int MAX_HEIGHT = 1024;
int MAX_WIDTH = 1024;
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
InputStream imageStream = context.getContentResolver().openInputStream(photoURI);
@root-ansh
root-ansh / MainActivity.java
Created June 3, 2019 01:17
Delegation to system ui camera
View MainActivity.java
public class MainActivity extends AppCompatActivity {
private static final int RQ_CAPTURE_IMG_CODE_HDPIC = 101;
private static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".provider";
private static final String TAG = "$1477$";
Uri tmpPhotoURI;
ImageView ivTemp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@root-ansh
root-ansh / MainActivity.java
Created June 3, 2019 00:05
Camera basics : delegating to system camera api
View MainActivity.java
public class MainActivity extends AppCompatActivity {
private static final int RQ_CAPTURE_IMG_CODE_THUMB = 100;
ImageView ivTemp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ivTemp = findViewById(R.id.iv_tmpcheck);
@root-ansh
root-ansh / manifest.xml
Created June 2, 2019 23:55
Camera basics : delegating to system camera api
View manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="z.y.x.camera">
<uses-feature
android:name="android.hardware.camera.any"
android:required="true" />
...
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher" ...>
@root-ansh
root-ansh / MainActivity.java
Created June 2, 2019 23:40
Camera basics:Delegating to system cam
View MainActivity.java
public class MainActivity extends AppCompatActivity {
ImageView ivTemp;
Button btCallCameraThumbnail;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ivTemp = findViewById(R.id.iv_tmpcheck);
@root-ansh
root-ansh / app_bar_main.xml
Created July 1, 2018 22:16
Custom drawer 1.5
View app_bar_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
...
>
<com.google.android.material.appbar.AppBarLayout
...
>