Skip to content

Instantly share code, notes, and snippets.

View ashwanikumar04's full-sized avatar

Ashwani Kumar ashwanikumar04

View GitHub Profile
@ashwanikumar04
ashwanikumar04 / server.tf
Last active January 31, 2017 11:02
Terraform file to create an AWS instance
#Taken from Terraform Site
provider "aws" {
access_key = "ACCESS_KEY_HERE"
secret_key = "SECRET_KEY_HERE"
region = "us-east-1"
}
resource "aws_instance" "example" {
ami = "ami-0d729a60"
instance_type = "t2.micro"
@ashwanikumar04
ashwanikumar04 / static-data-compressor.js
Created March 25, 2017 15:23
Compress html, json, css and js resources
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var cleanCSS = require('gulp-clean-css');
var gutil = require('gulp-util');
var htmlmin = require('gulp-htmlmin');
var del = require('del');
var argv = require('yargs').argv;
var jsonMinify = require('gulp-json-minify');
var gulpCopy = require('gulp-copy');
var runSequence = require('run-sequence');
@ashwanikumar04
ashwanikumar04 / Commands.md
Last active May 22, 2019 03:17
Changes in build.gradle to integrate gulp with build process
./gradlew iG
cd app/gulp-task

npm install
@ashwanikumar04
ashwanikumar04 / Log
Created March 26, 2018 04:34
Test log
```
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: com.example.thagadur.bakingappudacity:id/recyclerview
View Hierarchy:
+>DecorView{id=-1, visibility=VISIBLE, width=1080, height=1920, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
|
+->LinearLayout{id=-1, visibility=VISIBLE, width=1080, height=1776, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+-->ViewStub{id=16909295, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false
@ashwanikumar04
ashwanikumar04 / SortingCSV.java
Created March 31, 2018 17:27
Sort a csv based on mutiple columns
package in.ashwanik.questions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
/**
* Sorting a csv based on multiple columns.
* Something like Select * from csv order by column 1 ASC, column2 DESC
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="0dp"
@ashwanikumar04
ashwanikumar04 / Cheatsheet.md
Last active October 11, 2020 06:41
Cheat sheet for Git
@ashwanikumar04
ashwanikumar04 / image-augmentation-random-cutout-tf2.3.1.py
Last active January 2, 2021 01:19
Random cutout image augmentation preprocessing layer for tensorflow keras for tf 2.3.1
# working Kaggle notebook is available at https://www.kaggle.com/ashwanikumar04/image-aug-keras-custom-cutout-preprocessing-layer
import tensorflow_addons as tfa
from tensorflow.python.keras.engine.input_spec import InputSpec
from tensorflow.python.keras.engine.base_preprocessing_layer import PreprocessingLayer
from tensorflow.python.keras.utils import tf_utils
class RandomCutout(PreprocessingLayer):
"""Creates random mask on the image.
Input shape:
4D tensor with shape:
@ashwanikumar04
ashwanikumar04 / image-augmentation-random-cutout-tf2.4.0.py
Last active January 2, 2021 01:20
Random cutout image augmentation preprocessing layer for tensorflow keras for tf 2.4.0
# working Kaggle notebook is available at https://www.kaggle.com/ashwanikumar04/image-aug-keras-custom-cutout-preprocessing-layer
import tensorflow_addons as tfa
from tensorflow.python.keras.engine.input_spec import InputSpec
from tensorflow.python.keras.engine.base_preprocessing_layer import PreprocessingLayer
from tensorflow.python.keras.engine import base_preprocessing_layer
from tensorflow.python.keras.utils import control_flow_util
class RandomCutout(PreprocessingLayer):
"""Creates random mask on the image.