Skip to content

Instantly share code, notes, and snippets.

View avikjis27's full-sized avatar
🤝
Committed to the essence of humanity

Avik Chakraborty avikjis27

🤝
Committed to the essence of humanity
View GitHub Profile
@avikjis27
avikjis27 / gitalias.txt
Last active April 7, 2021 07:42
Git alias
# ## Usage
#
# Update file `~/.gitconfig` like:
#
# [alias]
# br = branch
# ci = commit
br = branch
changelog = log \\$(./git describe --abbr=0)..HEAD --pretty=format:" * %h %s"
@avikjis27
avikjis27 / Permutation.py
Created October 29, 2020 07:25
Find all the permutation with NO repeating character
##Input -> abc
##Output->
## acb
## abc
## cab
## cba
## bac
## bca
##Note: This wont give correct result for aabc or abbc like strings having repeating chars
@avikjis27
avikjis27 / SearchBalancedString.py
Last active May 28, 2022 11:19
Search for Largest balanced sub string
#A string is considered balanced when every letter in the string appears both in uppercase and lowercase. For example,
#CATattac is balanced (a, c, t occur in both cases). Madam is not (a, d only appear in lowercase). Write a function
#that given #a string returns the shortest balanced substring of that string. I have tried using below approaches as
#described in the #answer by @CodeHunter. Can anyone suggest any better time or space complexity solution?
#Update: More examples "azABaabza" returns "ABaab" "TacoCat" returns -1 (not balanced) "AcZCbaBz" returns the entire string
def doInvert(letter):
if(letter.isupper()):
return letter.lower()
else:
@avikjis27
avikjis27 / docker-cleanup.md
Last active February 19, 2020 14:08
Clean docker container and images
  • Clean images
docker rmi -f `docker images -a --format {{.ID}}` 
  • Clean container
docker rm `docker ps -a --format {{.ID}}`
public class PreIncrement{
public static void main(String[] args){
int a;
int b = 3;
a = ++b; //4
}
}
/*
Classfile /Users/avichakrabormac0s/Desktop/PreIncrement.class
@avikjis27
avikjis27 / handy.sh
Last active October 24, 2018 08:29
Some handy devops commands for daily use
#start and stop jenkins
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist #Stop
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist # Start
#to delete all helm release
helm ls --all --short | xargs -L1 helm delete --purge
#to run a ubuntu pod in k8s
kubectl run my-shell --rm -i --tty --image ubuntu -- bash
apt update
@avikjis27
avikjis27 / clean.sh
Last active August 9, 2020 04:57
How to remove all docker container and images
docker stop $(docker ps -a -q)
docker rm `docker ps -a --format {{.ID}}`
docker rmi -f $(docker images -a -q)
@avikjis27
avikjis27 / 2016-03-25-heroku-java-deploy-procfile
Created March 26, 2016 09:30
2016-03-25-heroku-java-deploy-procfile
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
@avikjis27
avikjis27 / 2016-03-25-heroku-java-deploy-pom.xml
Last active March 26, 2016 09:29
2016-03-25-heroku-java-deploy
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MyHerokuTestApp01</groupId>
<artifactId>MyHerokuTestApp01</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<!DOCTYPE html>
<html>
<head>
<script src="handlebars-v3.0.0.js"></script>
<script id="handlebar_template" type="text/x-handlebars-template">
<h2> Welcome: {{person.name}} {{person.last}} </h2>
</script>
</head>
<body>