This file contains hidden or 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
public static void showProgressWithETA(int current, int total, long startTime) { | |
long elapsedTimeMillis = System.currentTimeMillis() - startTime; | |
int percent = current * 100 / total; | |
int progress = percent / 2; | |
System.out.print("\r["); | |
for (int i = 0; i < progress; i++) { | |
System.out.print("\u001b[32m=\u001b[0m"); | |
} | |
for (int i = progress; i < 50; i++) { | |
System.out.print(" "); |
This file contains hidden or 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
# Get input path from user | |
$path = Read-Host "Enter file or folder path" | |
# Check if input path is a file or folder | |
if (Test-Path $path -PathType Leaf) { | |
# If path is a file, process it and save output to 'Cleaned' subdirectory | |
$outputPath = Join-Path (Split-Path $path) "Cleaned" | |
New-Item -ItemType Directory -Path $outputPath -Force | |
(Get-Content $path -Raw) -replace "\x1B\[[0-9;]*[mK]" | Set-Content (Join-Path $outputPath (Split-Path $path -Leaf)) | |
} elseif (Test-Path $path -PathType Container) { |
This file contains hidden or 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
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" input_file > output_file | |
(Get-Content input_file) -replace "\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]", "" | Set-Content output_file |
This file contains hidden or 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
To test features on any domain that needs HTTPS (Secured) connection - | |
enable these settings - | |
for chrome -go to chrome://flags/#unsafely-treat-insecure-origin-as-secure ->then enter domain and enable it | |
for firefox - go to about:config ->then enable -> media.getusermedia.insecure.enabled |
This file contains hidden or 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
REM originally found here - https://medium.com/tinywave/svn-automatic-update-using-batch-file-9eaf78f226b9 | |
set CHECKOUTFOLDER=D:\folder1*D:\folder2 | |
set SVNPATH=C:\Program Files\TortoiseSVN\bin | |
"%SVNPATH%\TortoiseProc.exe" /command:update /path:"%CHECKOUTFOLDER%" /closeonend:2 |
This file contains hidden or 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" | |
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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" |