start new:
tmux
start new with session name:
tmux new -s myname
| from django.conf import settings | |
| from django.utils.http import urlquote | |
| from django import http | |
| class EnforceHostnameMiddleware(object): | |
| """ | |
| Enforce the hostname per the ENFORCE_HOSTNAME setting in the project's settings | |
| The ENFORCE_HOSTNAME can either be a single host or a list of acceptable hosts | |
| """ |
| # -*- coding: utf-8 -*- | |
| from django.contrib.auth.decorators import login_required | |
| from django.utils.cache import patch_response_headers | |
| from django.utils.decorators import method_decorator | |
| from django.views.decorators.cache import cache_page, never_cache | |
| from django.views.decorators.csrf import csrf_exempt | |
| class NeverCacheMixin(object): | |
| @method_decorator(never_cache) |
| # Factories are used to give each class it's own dependency management | |
| angular.module('myApp', ['ngCookies']) | |
| .factory('BaseObject', ['$log', '$http', ($log, $http) -> | |
| # The instance-classes are returned at the end of the factory and can be injected (unmodified) | |
| class BaseObject | |
| constructor: (@options) -> | |
| send: (args) -> | |
| $log.log('sending', args) | |
| $http(args) |
| #!/usr/bin/python | |
| # rtorrent_xmlrpc | |
| # (c) 2011 Roger Que <[email protected]> | |
| # | |
| # Python module for interacting with rtorrent's XML-RPC interface | |
| # directly over SCGI, instead of through an HTTP server intermediary. | |
| # Inspired by Glenn Washburn's xmlrpc2scgi.py [1], but subclasses the | |
| # built-in xmlrpclib classes so that it is compatible with features | |
| # such as MultiCall objects. |
| auth_basic "Restricted"; | |
| auth_basic_user_file /etc/nginx/htpasswd; |
To demonstrate text classification with Scikit Learn, we'll build a simple spam filter. While the filters in production for services like Gmail will obviously be vastly more sophisticated, the model we'll have by the end of this chapter is effective and surprisingly accurate.
Spam filtering is the "hello world" of document classification, but something to be aware of is that we aren't limited to two classes. The classifier we will
| System | |
| ====== | |
| Windows 7 | |
| Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] | |
| Small data | |
| ========== |
| # Initialize the scroll | |
| page = es.search( | |
| index = 'yourIndex', | |
| doc_type = 'yourType', | |
| scroll = '2m', | |
| search_type = 'scan', | |
| size = 1000, | |
| body = { | |
| # Your query's body | |
| }) |
| <div id="main-container"> | |
| <div id="main"> | |
| <h1> | |
| <img alt="scubabook logo" src="{{ static_url("img/logo.png") }}"> | |
| </h1> | |
| <div id="login-form"> | |
| <form action="/auth/login/" method="post" id="login_form"> | |
| <fieldset> | |
| <label for="username">Username</label> | |
| <input autocapitalize="off" autocorrect="off" class="text-input" id="username" name="username" tabindex="1" type="text" value=""> |