Skip to content

Instantly share code, notes, and snippets.

@MVKozlov
MVKozlov / SGP201507
Last active August 29, 2015 14:24
2015-July Scripting Games Puzzle
#local computer
&{param($c='.')gwmi CIM_OperatingSystem -cn $c|Select PSC*,*j*,V*,@{n='BIOSSerial';e={(gwmi Win32_Bios -cn $_.csname).SerialNumber}}}
#remote Computer(s)
&{param($c='.')gwmi CIM_OperatingSystem -cn $c|Select PSC*,*j*,V*,@{n='BIOSSerial';e={(gwmi Win32_Bios -cn $_.csname).SerialNumber}}} comp1,comp2
#less powershelly(imho) but shorter
&{param($c='.')gwmi CIM_OperatingSystem -cn $c|ft PSC*,*j*,V*,@{n='BIOSSerial';e={(gwmi Win32_Bios -cn $_.csname).SerialNumber}}}
@MVKozlov
MVKozlov / JAPE.ps1
Last active October 21, 2015 08:42
#Author: Max Kozlov – Date: October 21th, 2015
'AWESOME,I LIKE IT,WHO IS THIS GUY ?' |%{ $MOM, $SAID, $TO, $ME =(
$MY *0), $ANSWER ,'\}ix@_dLn9bl<f@qjO{ae=fD6smbyDag}E<',
0}{([char[]]$_|%{[char]([byte]'/'[-1]+ $TO[ $MOM ++]-
$_)})-join''}
#Author: Max Kozlov - Date: October 28th, 2015
#Ugly ASCII Art. Against 4line standart, but anyway, it is art :))
'&[%c5oI'+ 'n8v~eo'+ 'rm'+
'to]z: :('+ 'T7o''BNa'+ 'Ns'''+
'eG'+ '6p'+ '4D'+ 'S~'+
'to'+ 'ro'+ 'iy'+ 'n>'+
'g.(N$~2>'+ ')(-XcGrZ'+ 'ez'+
'p\lza?c'+ '?eQ''K[,a'+ 'G-{'+
'zA0'+ ' -.9-]'+ ' +.''>'+
'->r'+ 'heC'+ 'pz'+
#Author: Max Kozlov - Date: October 31th, 2015
#Most cryptic one :)
'IE;FAMNJhWJMmYMQ@IY~KT:YMAISLyUR@YJBD^M$'|%{$nul,$shr,$shl,$lt,$char,$join,
$byte,[byte[]]$eq=[char[]]$_}-en{($iex="$nul$lt")}|%{$ne,$gt,$eq=$eq}-en{$nul
}|%{iex((gdr *unc*).($byte,$char,$join,$shr-join,$null),'eq($eq){$ge,$eq=',
'$eq',$shl,$iex,'($ge-gt$gt){$ge-=$gt/2',$shl,'(1-shl5)}',$shl,'($ne=$ne+$ge-
$gt+2+($gt-shr2))',$shl,$iex,'($eq){eq -eq $eq}}'-join,[char](1-shl5))}-en{
$gt}|%{($ne,(eq -eq $eq)|%{$_|%{[char]$_}})-join,$null}
#Author: Max Kozlov - Date: October 31th, 2015
#The shortest one (but slightly above 77 chars :)
-join(' OO,LTEHELNHJWSENSUIEATRTSPSAH RTU'|%{$h=@{s=1Mb;c=1Gb}}{[char[]]$_|get-random @h})
#Author: Max Kozlov - Date: October 31th, 2015
#Where's my data source?
(&{($myinvocation|fl *Pa*,Sc*,Pi*,Di*,J*,W*,L*|out-string)[253,6,18,15,19,
10,7,5,15,44,14,11,19,9,5,256,14,11,18,44,14,64,64,19,14,7,15,44,6,18,61,
10,18,15,258]})-join''
#Author: Max Kozlov - Date: November 3th, 2015
#Random numbers...
-join(17980512,4794238,32775459,141008,18327210,9100087,2892629|%{1..5|%{$s=
@{s=$_;mi=0;ma=26}}{Get-Random @s;$s.Remove('s')}}|%{$$,$1,$2=65,32,44}{[
char]$(switch($_){default{$_+$$}25{$1}24{$2}})})
// http://powershell.com/cs/blogs/tips/archive/2014/01/10/change-desktop-wallpaper.aspx
// slightly modified and converted to application
// How to compile it: save SetDesktopWallpaper.cs to Documents folder, start Powershell and copy and paste following commands
//
// cd ([System.Environment]::GetFolderPath('MyDocuments'))
// $compiler = Join-Path ([Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) csc.exe
// & $compiler /out:SetDesktopWallpaper.exe /target:winexe SetDesktopWallpaper.cs
//
// the command compile SetDesktopWallpaper.cs to SetDesktopWallpaper.exe
// use it as SetDesktopWallpaper.exe <path_to_wallpaper> <wallpaper_style>
param(
$Uri,
$Body,
$Certificate,
$CertificateThumbprint,
$ContentType,
$Credential,
$DisableKeepAlive,
$Headers,
$InFile,
function Test-RSJob([bool]$FullPiping=$true) {
$ScriptBlock = { "{0}: {1}" -f $_, [DateTime]::Now; Start-Sleep -Seconds 5 }
$params = @{ Batch='throttletest'; ScriptBlock=$ScriptBlock; Throttle=5 }
if ($FullPiping) {
$jobs = 1..25 | Start-RSJob @params
}
else {
$jobs = 1..25 | Foreach-Object { $_ | Start-RSJob @params }
}
$jobs | Wait-RSJob | Receive-RSJob