Skip to content

Instantly share code, notes, and snippets.

View bogdangrigg's full-sized avatar

Luca-Bogdan Grigorescu bogdangrigg

View GitHub Profile
@bogdangrigg
bogdangrigg / Install-TelnetClient.ps1
Created November 15, 2018 14:23
Install the telnet client on Windows
Install-WindowsFeature -name Telnet-Client
# or
dism /online /Enable-Feature /FeatureName:TelnetClient
@bogdangrigg
bogdangrigg / Base64Tools.ps1
Last active April 19, 2019 19:55
base64 encode & decode
# encode
$Text = "Hidden secret!"
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text) # or Unicode.GetBytes($Text), if Unicode is not needed
$EncodedText =[Convert]::ToBase64String($Bytes)
$EncodedText
# decode
$EncodedText = “SABpAGQAZABlAG4AIABzAGUAYwByAGUAdAAhAA==”
$DecodedText = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($EncodedText))
$DecodedText
@bogdangrigg
bogdangrigg / log-tools.sh
Created April 29, 2019 14:26
Log parsing snippets
# Realtime lines per second in a log file
tail -f /var/log/logfile | perl -e 'while (<>) {$l++;if (time > $e) {$e=time;print "$l\n";$l=0}}'