This guide assumes a fresh install of Mac OSX 10.7 Lion.
This file contains 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 os | |
from PIL import Image | |
size = 145, 145 | |
dir_path = '/Users/brian/Desktop/systems' | |
for filename in os.listdir(dir_path): | |
if filename.endswith('.bmp'): | |
# Destroy Previously Converted BMP | |
try: | |
os.remove(os.path.join(dir_path,filename.replace('.jpg','.bmp'))) | |
except: |
This file contains 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
$cred = Get-Credential #Read credentials | |
$username = $cred.username | |
$password = $cred.GetNetworkCredential().password | |
# Get current domain using logged-on user's credentials | |
$CurrentDomain = "LDAP://hillsborough.k12.nj.us" | |
$domain = New-Object System.DirectoryServices.DirectoryEntry($CurrentDomain,$UserName,$Password) | |
if ($domain.name -eq $null) | |
{ |
This file contains 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
### USAGE | |
### | |
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0 | |
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4 | |
### ./ElasticSearch.sh will fail because no version was specified (exit code 1) | |
### | |
### CLI options Contributed by @janpieper | |
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch | |
### ElasticSearch version |
This file contains 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 random | |
class MasterSlaveRouter(object): | |
def db_for_read(self, model, **hints): | |
""" | |
Reads go to a randomly-chosen slave. | |
""" | |
return random.choice(['master','slave1', 'slave2']) | |
def db_for_write(self, model, **hints): |
This file contains 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
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.mysql', | |
'NAME': 'anotherdatabase', | |
'USER': 'anotherusername', | |
'PASSWORD': 'anotherpassword', | |
'HOST': '192.168.1.1', | |
'PORT': '', | |
}, | |
'master': { |
This file contains 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 | |
"""MailBox class for processing IMAP email. | |
(To use with Gmail: enable IMAP access in your Google account settings) | |
usage with GMail: | |
import mailbox | |
This file contains 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
from django.db import models | |
from django.contrib.auth.models import User | |
class Person(models.Model): | |
employee_id = models.IntegerField(unique=True,editable=False) | |
username = models.CharField(max_length=50,unique=True,editable=False) | |
state_id = models.IntegerField(unique=True,null=True,blank=True,editable=False) | |
email = models.EmailField(max_length=50,unique=True,editable=False) | |
firstname = models.CharField(max_length=50,editable=False) | |
lastname = models.CharField(max_length=50,editable=False) |
This file contains 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
def __unicode__(self): | |
if self.name: | |
return u'%s' % (self.name) | |
elif self.assettag: | |
return u'%s' % (self.assettag) | |
elif self.mac_wired: | |
return u'%s' % (self.mac_wired) | |
elif self.model.chassis: | |
return u'%s' % (self.model.chassis) | |
else: |
This file contains 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
--- | |
- hosts: django_app_servers | |
serial: 1 | |
remote_user: admin | |
sudo: yes | |
tasks: | |
- name: Send Maintenance Mode Command to HaProxy | |
shell: curl --data "s={{inventory_hostname}}&b=#12&action=drain" http://user:password@haproxy1.local:8080/haproxy?stats |