This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Very simple OpenStack Nova notifier to create/delete PowerDNS records for instances on creation/deletion. | |
Format of records is %(instance)s.%(project_name).example.com. | |
To use: | |
* Install this in a python path (site-packages is easiest) | |
* Configure nova using notification_driver=examplenotifier | |
''' | |
import MySQLdb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can switch multiple relays on the same was as single relays – it’s just a different value passed. | |
If you think of the relays as 1, 2, 4, 8 then it makes sense. Passing these values directly will turn on the relays singularly, something like | |
for relay in [1, 2, 4, 8]: | |
bus.write_byte_data(0×20,0×09,relay) | |
time.sleep(1) | |
will step though all the relays (this is what the test_relays script does). | |
If you want to switch multiple relays on, add the numbers together and use that. For example: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Cloudflare settings | |
$CF_API_TOKEN = ""; | |
$CF_ZONE = ""; | |
$CF_EMAIL = ""; | |
// API key | |
$AUTHORIZATION_KEY = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drop into content/_plugins/pagination.rb | |
# Outputs pages into /1/ /2/ /3/ /4/ etc | |
module Jekyll | |
module Generators | |
class Pager < Pager | |
def self.paginate_path(site_config, num_page) | |
return nil if num_page.nil? || num_page <= 1 | |
"/%d" % num_page | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
import urllib2 | |
from BeautifulSoup import BeautifulSoup | |
url = 'http://support.lenovo.com/templatedata/Web%20Content/JSP/' \ | |
'warrantyLookup.jsp' | |
data = urllib.urlencode({'sysSerial' : 'xxxxxx'}) | |
req = urllib2.Request(url, data) | |
response = urllib2.urlopen(req) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{'cpu': [{'manufacturer': 'GenuineIntel', | |
'model': 'Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz'}], | |
'drives': [{'identifer': 'disk0', | |
'model': 'VMware Virtual S', | |
'size': 681574400, | |
'vendor': 'VMware,'}], | |
'interfaces': {'identifer': 'en0', 'mac-address': 'xx:xx:xx:xx:xx:x'}, | |
'manufacturer': 'Mac', | |
'memory': [{'manufacturer': 'VMware Virtual RAM', | |
'serial': '1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assumes the following: | |
# Hostname: TEST1 | |
# Domain: EXAMPLE.COM (you probably don't want to use your public domain for your AD domain... but that's out of scope for this example) | |
# Admin user: setupuser | |
# Admin pass: He11oW0rld! | |
# Machine will go into the default computers ou (root) | |
# Domain admins will get local admin rights on login | |
# All users will get mobile accounts (offline login) | |
# All data will be stored locally (no UNC home dir) | |
# Default shell will be bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Damians-Mac:~ damian$ hdid xcode46cltools_10_86938131a.dmg | |
/dev/disk2 Apple_partition_scheme | |
/dev/disk2s1 Apple_partition_map | |
/dev/disk2s2 Apple_HFS /Volumes/Command Line Tools (Lion) | |
Damians-Mac:~ damian$ sudo installer -pkg /Volumes/Command\ Line\ Tools\ \(Mountain\ Lion\)/Command\ Line\ Tools\ \(Mountain\ Lion\).mpkg -target / | |
Damians-Mac:~ damian$ umount /Volumes/Command\ Line\ Tools\ \(Mountain\ Lion\) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
traceroute to 216.81.59.173 (216.81.59.173), 64 hops max, 52 byte packets | |
1 10.44.200.254 (10.44.200.254) 5.057 ms 3.215 ms 4.460 ms | |
2 host-2-97-96-1.as13285.net (2.97.96.1) 95.907 ms 31.328 ms 30.944 ms | |
3 host-78-151-225-101.static.as13285.net (78.151.225.101) 32.417 ms 32.150 ms 32.657 ms | |
4 host-78-151-225-26.static.as13285.net (78.151.225.26) 33.414 ms | |
host-78-151-225-108.static.as13285.net (78.151.225.108) 32.723 ms | |
host-78-151-225-26.static.as13285.net (78.151.225.26) 33.472 ms | |
5 xe-11-1-0-rt001.the.as13285.net (62.24.240.6) 38.430 ms 39.111 ms | |
xe-11-1-0-rt001.sov.as13285.net (62.24.240.14) 39.522 ms | |
6 host-78-144-1-61.as13285.net (78.144.1.61) 38.020 ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
import re | |
import socket | |
from pysnmp.entity.rfc3413.oneliner import cmdgen | |
cmdGen = cmdgen.CommandGenerator() | |
CARBON_IP = '10.44.206.51' | |
CARBON_PORT = 2030 |