Easily Generate Random Numbers with Javascript

Sometimes you need a random number from javascript. In this case I needed to get a random integer to select a CSS class referencing a header image from an array to randomly show a header graphic.

Here’s the snippet:

Math.random() generates a “floating-point, pseudo-random number” in the range of 0 and 1. For example:

 

To get an integer for use as an array index another javascript method is required: Math.floor()

For example – to generate a random integer between 0 and 6:

Or put it all in a function for easy re-use and to get a random number of any size:


// Returns a random integer between min and max
// Using Math.round() will give you a non-uniform distribution!
function getRandomInt(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

Reference:
Math.random – JavaScript | MDN.

Export email addresses with particular domain – Microsoft Exchange

Here’s a handy Microsoft Exchange Shell command to export a list of users with a specific domain name.

Get-Mailbox -resultsize unlimited | Select-Object displayname -expandproperty emailaddresses| Where-Object {$_.smtpaddress -like "*domain.com*"}| Select-Object displayName,SmtpAddress | Export-csv C:\domain.csv

Export email addresses with particular domain – Spiceworks.

Test post 1

Test post content…. Test post content…. Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….Test post content…. Test post content….

Setup – KeePass Auto-Typing in Ubuntu

Setting up the Auto-Type KeePass hotkey in Ubuntu is pretty simple and saves time. Just open the “Keyboard” -> “Shortcuts” settings dialogue, click “Custom Shortcuts”, click the “+” sign,  with the path to your keepass2 executable with the “–auto-type” parameter. (/usr/bin/keepass2 –auto-type) in my case.

Click “Apply”.

Click “New shortcut”, press “CTRL + ALT + A” – it should save, close the dialogue and KeePass auto typing should be good to go.

Reference, KeePass documentation:

Setup – KeePass.