This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Array<DoubleArray>.minIndexOfColumnsOfRow(rowNumber: Int): Int { | |
var minNum = this[0][rowNumber] | |
var minIndex = 0 | |
repeat(this.size) | |
{ x -> | |
if (minNum > this[x][rowNumber]) { | |
minIndex = x | |
minNum = this[x][rowNumber] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun BufferedImage.getTransposed(): BufferedImage { | |
val transposeImage = BufferedImage(this.height, this.width, BufferedImage.TYPE_INT_RGB) | |
repeat(transposeImage.width) { w -> | |
repeat(transposeImage.height) { h -> | |
transposeImage.setRGB(w, h, this.getRGB(h, w)) | |
} | |
} | |
return transposeImage | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun InputElement.setAccept(acceptedTypes: String): Unit = element.execute("$jsExpression.accept=\"$acceptedTypes\";") | |
fun InputElement.multiple(isMultiple: Boolean): Unit = element.execute("$jsExpression.multiple=\"$isMultiple\";") | |
//Usage- | |
input(InputType.file).let { | |
it.setAccept("audio/*") | |
it.multiple(true) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ask the user for maven binary link | |
echo "Please input maven binary link : ex-https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" | |
echo | |
read mavenLink | |
echo You entered $mavenLink | |
wget $mavenLink -P /tmp | |
sudo tar xf /tmp/apache-maven-*.tar.gz -C /opt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "No ports provided" | |
exit 1 | |
fi | |
for var in "$@" | |
do | |
sudo kill -9 $(sudo lsof -t -i:${var}) | |
echo "Process using port ${var} was killed" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "No commit message provided" | |
exit 1 | |
fi | |
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') | |
IFS='/' read -r id bname<<< "$branch" | |
if test -z $bname | |
then | |
IFS='_' read -r id bname<<< "$branch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') | |
IFS='/' read -r id bname <<< "$branch" | |
IFS='_' read -r id bname <<< "$bname" | |
git update-index -q --refresh | |
if ! git diff-index --quiet HEAD --; then | |
echo "Working directory not clean, please commit your changes first" | |
exit | |
fi | |
echo "-------------------------------------------------------------------------" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "No jira id provided" | |
exit 1 | |
fi | |
nohup xdg-open http://jira.yourdomain.com/browse/${1} | |
#usage - openJira.sh jiraid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dir *.exe | ForEach-Object { & "$($env:ProgramFiles)\7-Zip\7z.exe" a -tzip "$($_.BaseName).zip" $_.Name } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://www.nuget.org/packages/libphonenumber-csharp | |
public static string GetMobileMask(string regionCode) // "IN" | |
{ | |
try | |
{ | |
var exampleNumber = PhoneNumberUtil.GetExampleNumberForType(regionCode, PhoneNumberType.MOBILE); | |
var formattedNumber = PhoneNumberUtil.FormatNumberForMobileDialing(exampleNumber, regionCode, true)[1..]; | |
var mask = Regex.Replace(formattedNumber, @"\d", "0"); //change 0 to whatever you want, my controls treats 0 as any digit | |
return mask; //"00000 0000" | |
} |
OlderNewer