This site now uses Google Analytics

This is a disclaimer – I’m using google analytics on my website now.

I have deactivated as much as you can in terms of letting google use the data. All data will only be used by me – will not be sold or anything. I’m doing this solely out of interest.

Powershell: Stress your CPU with some Prime Numbers

#get number of cores
$cpu = Get-WmiObject win32_processor | Select-Object Numberoflogicalprocessors
$cores = [convert]::ToInt32($cpu.Numberoflogicalprocessors, 10)

#define functions
function get-prime($i){
        
     for ($a=3; $a -lt $i; $a++){
        if ($i % $a -eq 0){
            return "no"
        }
        else{}
     }
}
    
#create a task for each core
foreach ($core in 1..$cores){
    start-job -ScriptBlock {
        
        for ($i=1000000; $i -le 10000000; $i++){
            $prime = get-prime($i)
            if ($prime -ne "no"){
                write-output "$i"
                }
            else {}
        }
    }

}

Wait-job *
clear
Receive-Job *
remove-job         

Snoverisms: POSH – Like programming with hand grenades Sticker

I stumbled upon a post in /r/powershell which linked to this site: http://snoverisms.com/
I liked the first quote so much that I made a sticker with a Silhouette printer!
Here’s the PNG (In Silhouette you have to insert PNG’s and later convert them to svg like files … whatever): powershell

The stickers look like this
here’s the positive:
positive

and here’s the negative (already on my notebook sorry!):
negative

MOTD for Powershell (Using the fortune-mod (linux) Package files)

I downloaded and altered the fortune-mod fortune files so that there’s one fortune per line. This can be downloaded here:
http://pastebin.com/TnxeyWJm

Next step is to add the following thing to your $Profile

function get-motd{
$fortunes = get-content \path\to\fortunes.txt
get-random -InputObject $fortunes
}
.......
clear-host
get-motd{}

It’s virtually important that you run the function after the clear-host. Otherwise the quote will not appear / will be erradicated before it even had time to present itself to you)