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
from django.contrib import admin | |
#other imports removed | |
def copy_course(modeladmin, request, queryset): | |
import copy | |
for course in queryset: | |
# multiple could be selected | |
course_copy = copy.copy(course) # django copy object |
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
--- | |
- 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 |
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.shortcuts import render_to_response, get_object_or_404, render | |
from django.template import RequestContext, loader, Template | |
from myapp.models import Model_name | |
# Template from app directory (lumber), passing in "data" | |
doc_template = loader.get_template('lumber/%s/result.txt' % ("my_label")) | |
doc_context = RequestContext(request, { | |
'data': result['source'], | |
}) | |
doc_html = doc_template.render(doc_context) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<form> | |
Enter URL to load: <input type="text" id="url" /> | |
<input type="button" value="Load URL" onclick="loadUrl()" /> |
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 logging.handlers import SysLogHandler | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'formatters': { | |
'standard': { | |
'format' : "[YOUR PROJECT NAME] [%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", | |
'datefmt' : "%d/%b/%Y %H:%M:%S" | |
}, | |
'verbose': { |
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 logging | |
# Standard instance of a logger with __name__ | |
logger = logging.getLogger(__name__) | |
# choose your own adventure | |
logger.info('message goes here') | |
logger.debug('message goes here') | |
logger.warning('message goes here') | |
logger.exception('message goes here') |
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
# Use shortcode to find latest TechNet download site | |
$confirmationPage = 'http://www.microsoft.com/en-us/download/' + $((invoke-webrequest 'http://aka.ms/wmf5latest' -UseBasicParsing).links | ? Class -eq 'mscom-link download-button dl' | % href) | |
# Parse confirmation page and look for URL to file | |
$directURL = (invoke-webrequest $confirmationPage -UseBasicParsing).Links | ? Class -eq 'mscom-link' | ? href -match 'Win8.1AndW2K12R2-KB3134758-x64.msu' | % href | select -first 1 | |
# Download file to local | |
$download = invoke-webrequest $directURL -OutFile $env:Temp\wmf5latest.msu | |
# Install quietly with no reboot | |
if (test-path $env:Temp\wmf5latest.msu) { | |
start -wait $env:Temp\wmf5latest.msu -argumentlist '/quiet /norestart' | |
} |