Skip to content

Instantly share code, notes, and snippets.

View ankschoubey's full-sized avatar

Ankush Choubey ankschoubey

View GitHub Profile
@ankschoubey
ankschoubey / clean-junit-test-format.java
Last active March 19, 2022 08:39
format for writing clean junit tests
View clean-junit-test-format.java
class {NameOfClass}Tests{
@Nested
@DisplayName("{methodName} method")
class {MethodName}Tests{
@Nested
@DisplayName("WHEN {condition description}")
class {ConditionDescription}Tests{
@ankschoubey
ankschoubey / webcam_to_jpg_file.py
Created January 4, 2020 15:43
Capture webcam frame and save as jpg
View webcam_to_jpg_file.py
import numpy as np
import cv2
from PIL import Image
import time
def get_webcam_frame():
cap = cv2.VideoCapture(0)
time.sleep(1) #because camera needs time starting
_, frame = cap.read()
cap.release()
@ankschoubey
ankschoubey / CleanNests.java
Created December 20, 2019 03:35
Tips on removing nesting
View CleanNests.java
import java.util.Arrays;
import java.util.List;
//PART OF Clean Code series //https://medium.com/@ankushchoubey/series-tips-on-writing-clean-code-30d717f32ae4
class Student { // POJO 🤘
String name;
List<Integer> grades;
// skipping getter/setter:
// tip: google "project lombok"
}
@ankschoubey
ankschoubey / 20191021_matrix_multiplication_from_scratch.ipynb
Created October 23, 2019 15:46
20191021_matrix_multiplication_from_scratch.ipynb
View 20191021_matrix_multiplication_from_scratch.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ankschoubey
ankschoubey / 20191021_broadcasting_and_rules.ipynb
Created October 21, 2019 15:24
20191021_broadcasting_and_rules.ipynb
View 20191021_broadcasting_and_rules.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ankschoubey
ankschoubey / pandas_profiling_separating_catvars_contvars.ipynb
Created August 5, 2019 18:49
Lazy programmers way to quickly get continuous and categorical variable. Specially useful for FastAI Tabular.
View pandas_profiling_separating_catvars_contvars.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ankschoubey
ankschoubey / pocketArticleDeleter.js
Created January 13, 2019 07:39
Pocket Automation (Delete articles that are either not 'Best of' or not star)
View pocketArticleDeleter.js
//Copy and paste this to developer console
function selectArticlesToDelete() {
var articles = document.getElementsByTagName('article');
var flag = false;
for (i = 0; i < articles.length; i++) {
article = articles[i];
if (article.getElementsByTagName('svg').length == 2 || article.textContent.includes('Best Of')) {
} else {
article.children[0].click();
flag = true;