This is a list of useful commands related to Python.

Jupyter notebook location

When starting jupyter notebooks on Windows the shortcut defaults to my profile directory.  To get round this create a jupyter config:

jupyter notebook --generate-config

This will be located in .jupyter\ within the profile directory.

Update c.FileContentsManager.root_dir to point to the folder for notebooks

Machine learning

Frequency analysis with Python

scikit-learn documentation

Azure Machine Learning documentation

Sequential data

Fraud detection with Azure Stream Analytics

Streaming analytics in Python

Anomaly detection

Azure anomaly detection

Azure One-Class Support Vector Machine

Enable RDS RestrictedAdmin mode

Enable for incoming connections:

Name: DisableRestrictedAdmin
Value: 0

To require for outgoing connections:

  1. Edit the Group Policy and navigate to the following node:
    Computer Configuration\Policies\Administrative Templates\System\Credentials Delegation
  2. Configure the value of “Restrict delegation of credentials to remote servers” to Enabled.

See for additional security features.

E-mail security

Validation tools:


F5 BIG-IP Rest API Security

I’ve been using the BIG-IP rest API to read the configuration of LTM, and I wanted to reduce the risk of accidental changes.  During my investigation I can across the post:, which showed the way to configure role based access control for the Rest API.

I wanted to create a new rule for a read only account (‘monitor’), the account is configured as Guest within BIG-IP.  In order to do this I created a new access rule you need the POST method:

curl -k -u admin:adminpass -X POST -d @addRule.json

where addRule.json is:

{"name": "iControl_REST_API_monitor","userReferences":[{"link":"https://localhost/mgmt/shared/authz/users/monitor"}],"resources":[{"resourceMask":"/mgmt/tm/ltm","restMethod":"GET"},{"resourceMask":"/mgmt/tm/ltm/*","restMethod":"GET"},{"resourceMask":"/mgmt/tm/ltm/*/*","restMethod":"GET"},{"resourceMask":"/mgmt/tm/ltm/*/*/*","restMethod":"GET"},{"resourceMask":"/mgmt/tm/ltm/*/*/*/*","restMethod":"GET"}]}

This worked fine until I discovered I did not have enough depth in rules to cover the data I wanted to retrieve. To update the rule you need the PUT method:

curl -k -u admin:adminpass -X PUT -d @updateRule.json

where updateRule.json is:


TMG from PowerShell

I recently had to perform an audit of TMG rules and used PowerShell to access the object model.  Below are a couple of sample commands that show accessing various parts of the TMG object model with PowerShell.

$tmg = New-Object -ComObject "FPC.Root"
$proxy = $tmg.Arrays | ? {$_.DNSName -eq "PROXY"}
($proxy.ArrayPolicy.PolicyRules | ? {$_.Name -eq "Allow Sample Sites Access"}).AccessProperties.DestinationDomainNameSets
($proxy.ArrayPolicy.PolicyRules | ? {$_.Name -eq "Allow Sample Sites Access"}).AccessProperties.UserSets
$proxy.RuleElements.DomainNameSets.Item("Sample Sites")
$proxy.RuleElements.UserSets.Item("Sample Site Access Group").Accounts

The following links are useful reference material for interpreting TMG logs: