Skip to content

Instantly share code, notes, and snippets.

@lampts
Created December 6, 2012 15:56
Show Gist options
  • Save lampts/4225556 to your computer and use it in GitHub Desktop.
Save lampts/4225556 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "daily"
},
"name": "daily",
"nbformat": 2,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": true,
"input": "import base64",
"language": "python",
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": true,
"input": "cd D:\\apps\n# aspnet_regiis.exe -i\n# iisreset",
"language": "python",
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": true,
"input": "import os",
"language": "python",
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": true,
"input": "print os.getcwd()",
"language": "python",
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": true,
"input": "image = 'B14a.bmp'\nimage_64 = base64.encodestring(open(image,\"rb\").read())",
"language": "python",
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": true,
"input": "print image_64",
"language": "python",
"outputs": [],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": "import wmi\n# Obtain network adaptors configurations\nnic_configs = wmi.WMI().Win32_NetworkAdapterConfiguration(IPEnabled=True)\n\n# First network adaptor\nnic = nic_configs[0]\n\n# IP address, subnetmask and gateway values should be unicode objects\nip = u'192.168.1.100'\nsubnetmask = u'255.255.255.0'\ngateway = u'192.168.1.1'\ndns = u'192.168.1.1'\n\n# Set IP address, subnetmask and default gateway\n# Note: EnableStatic() and SetGateways() methods require *lists* of values to be passed\nnic.EnableStatic(IPAddress=[ip],SubnetMask=[subnetmask])\nnic.SetGateways(DefaultIPGateway=[gateway])\nnic.SetDNSServerSearchOrder([dns])",
"language": "python",
"outputs": [],
"prompt_number": 63
},
{
"cell_type": "code",
"collapsed": false,
"input": "nic.EnableDHCP()\nnic.SetDNSServerSearchOrder(['8.8.8.8'])",
"language": "python",
"outputs": [],
"prompt_number": 64
},
{
"cell_type": "code",
"collapsed": true,
"input": "",
"language": "python",
"outputs": [],
"prompt_number": " "
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment