Skip to content

Instantly share code, notes, and snippets.

@Jack5079
Last active April 17, 2020 21:41
Show Gist options
  • Select an option

  • Save Jack5079/62465b106e0a3227bb7e5a76eedf0cc4 to your computer and use it in GitHub Desktop.

Select an option

Save Jack5079/62465b106e0a3227bb7e5a76eedf0cc4 to your computer and use it in GitHub Desktop.
powershell binary counting
param(
[long]$CountTo = [long](Read-Host 'Number to count to'),
[string]$Foreground = '█',
[string]$Background = ' ',
[decimal] $Interval = 1,
[decimal] $DivideBy = 1.1
)
$padding = [convert]::ToString($CountTo, 2).Length
$count = 0
Do {
[convert]::ToString(++$count, 2).PadLeft($padding, ' ') -replace '0', $Background -replace '1', $Foreground | Write-Host
Start-Sleep $Interval
$Interval /= $DivideBy
} while ($count -lt $CountTo)
Code:\Command Line\PowerShell ▸ .\counter.ps1
Number to count to: 275
        █
       █ 
       ██
      █  
      █ █
      ██ 
      ███
     █   
     █  █
     █ █ 
     █ ██
     ██  
     ██ █
     ███ 
     ████
    █    
    █   █
    █  █ 
    █  ██
    █ █  
    █ █ █
    █ ██ 
    █ ███
    ██   
    ██  █
    ██ █ 
    ██ ██
    ███  
    ███ █
    ████ 
    █████
   █     
   █    █
   █   █ 
   █   ██
   █  █  
   █  █ █
   █  ██ 
   █  ███
   █ █   
   █ █  █
   █ █ █ 
   █ █ ██
   █ ██  
   █ ██ █
   █ ███ 
   █ ████
   ██    
   ██   █
   ██  █ 
   ██  ██
   ██ █  
   ██ █ █
   ██ ██ 
   ██ ███
   ███   
   ███  █
   ███ █ 
   ███ ██
   ████  
   ████ █
   █████ 
   ██████
  █      
  █     █
  █    █ 
  █    ██
  █   █  
  █   █ █
  █   ██ 
  █   ███
  █  █   
  █  █  █
  █  █ █ 
  █  █ ██
  █  ██
  █  ██ █
  █  ███
  █  ████
  █ █
  █ █   █
  █ █  █
  █ █  ██
  █ █ █
  █ █ █ █
  █ █ ██
  █ █ ███
  █ ██
  █ ██  █
  █ ██ █
  █ ██ ██
  █ ███
  █ ███ █
  █ ████ 
  █ █████
  ██
  ██    █
  ██   █
  ██   ██
  ██  █
  ██  █ █
  ██  ██ 
  ██  ███
  ██ █
  ██ █  █
  ██ █ █ 
  ██ █ ██
  ██ ██
  ██ ██ █
  ██ ███
  ██ ████
  ███
  ███   █
  ███  █
  ███  ██
  ███ █
  ███ █ █
  ███ ██
  ███ ███
  ████
  ████  █
  ████ █
  ████ ██
  █████  
  █████ █
  ██████
  ███████
 █       
 █      █
 █     █
 █     ██
 █    █  
 █    █ █
 █    ██ 
 █    ███
 █   █
 █   █  █
 █   █ █
 █   █ ██
 █   ██
 █   ██ █
 █   ███
 █   ████
 █  █
 █  █   █
 █  █  █
 █  █  ██
 █  █ █
 █  █ █ █
 █  █ ██
 █  █ ███
 █  ██
 █  ██  █
 █  ██ █
 █  ██ ██
 █  ███
 █  ███ █
 █  ████
 █  █████
 █ █
 █ █    █
 █ █   █
 █ █   ██
 █ █  █  
 █ █  █ █
 █ █  ██
 █ █  ███
 █ █ █
 █ █ █  █
 █ █ █ █
 █ █ █ ██
 █ █ ██
 █ █ ██ █
 █ █ ███
 █ █ ████
 █ ██    
 █ ██   █
 █ ██  █
 █ ██  ██
 █ ██ █
 █ ██ █ █
 █ ██ ██
 █ ██ ███
 █ ███
 █ ███  █
 █ ███ █ 
 █ ███ ██
 █ ████
 █ ████ █
 █ █████
 █ ██████
 ██      
 ██     █
 ██    █
 ██    ██
 ██   █
 ██   █ █
 ██   ██
 ██   ███
 ██  █
 ██  █  █
 ██  █ █
 ██  █ ██
 ██  ██  
 ██  ██ █
 ██  ███
 ██  ████
 ██ █
 ██ █   █
 ██ █  █
 ██ █  ██
 ██ █ █
 ██ █ █ █
 ██ █ ██
 ██ █ ███
 ██ ██
 ██ ██  █
 ██ ██ █
 ██ ██ ██
 ██ ███
 ██ ███ █
 ██ ████
 ██ █████
 ███
 ███    █
 ███   █
 ███   ██
 ███  █  
 ███  █ █
 ███  ██
 ███  ███
 ███ █
 ███ █  █
 ███ █ █
 ███ █ ██
 ███ ██
 ███ ██ █
 ███ ███
 ███ ████
 ████    
 ████   █
 ████  █
 ████  ██
 ████ █
 ████ █ █
 ████ ██
 ████ ███
 █████
 █████  █
 █████ █ 
 █████ ██
 ██████  
 ██████ █
 ███████
 ████████
█        
█       █
█      █
█      ██
█     █
█     █ █
█     ██ 
█     ███
█    █
█    █  █
█    █ █
█    █ ██
█    ██
█    ██ █
█    ███
█    ████
█   █
█   █   █
█   █  █ 
█   █  ██
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment