使ってるのはMac版
- 動作軽い
- カラースキームが見やすくてよい
import os | |
SITE_ROOT = '/'.join(os.path.dirname(os.path.realpath(__file__)).split('/')[0:-2]) | |
DONT_HIT_DB = True | |
SLUMBER_API_HOST = "http://localhost" | |
TEMPLATE_DIRS = ( | |
'%s/readthedocs/templates/' % SITE_ROOT, | |
'%s/readthedocs/doc_builder/templates/' % SITE_ROOT, | |
) |
- name : 'setup pycharm project' | |
pycharm_project : project_dir={{item.project_dir}} venv={{item.venv}} additional_dir={{item.additional_dir}} | |
with_items: | |
- { project_dir='~/projects/openstack_havana_nova' venv='~/.virtualenv/openstack_havana_nova' additional_dir='~/repos/openstack_havana/nova' } | |
- { project_dir='~/projects/openstack_havana_neutron' venv='~/.virtualenv/openstack_havana_neutron' additional_dir='~/repos/openstack_havana/neutron' } |
import requests | |
payload = {'stuff': 'hirokiky', 'action': 'dec'} | |
url = 'http://karmaid.org/api/karma' | |
while True: | |
requests.post(url, params=payload) |
In [1]: def deco(arg): | |
...: def wrapper(func): | |
...: def _wrapper(): | |
...: return func(arg) | |
...: return _wrapper | |
...: return wrapper | |
...: | |
In [2]: @deco("ham") | |
...: def spam(egg): |
>>> from django import forms | |
>>> class CommentForm(forms.Form): | |
... name = forms.CharField(initial='class') | |
... | |
>>> f = CommentForm() | |
>>> print(f) | |
<tr><th><label for="id_name">Name:</label></th><td><input type="text" name="name" value="class" id="id_name" /></td></tr> | |
>>> f.fields['name'].initial | |
'class' |
from django.contrib import admin | |
from .models import Memo | |
class MemoAdmin(admin.ModelAdmin): | |
list_per_page = 5 | |
list_display = ['username', 'title'] | |
search_fields = ['user__username'] | |
def queryset(self, request): | |
qs = super(MemoAdmin, self).queryset(request) |
from django.test import TestCase | |
from . import models | |
import factory | |
class PollFactory(factory.Factory): | |
FACTORY_FOR = models.Poll | |
question = "What's up?" | |
pub_date = '2013-02-22' |
#!/usr/bin/env python | |
#coding: utf-8 | |
import os | |
import subprocess | |
import sys | |
PRE_PUSH_SCRIPT = 'pre-push' | |
POST_PUSH_SCRIPT = 'post-push' |
import cv | |
imgfile = '../data/members.jpeg' | |
im = cv.LoadImage(imgfile, 1) | |
cascade = cv.Load('../data/haarcascade_frontalface_default.xml') | |
faces = cv.HaarDetectObjects(im, cascade, cv.CreateMemStorage()) | |
for f in faces: | |
cv.Rectangle(im, | |
(f[0][0], f[0][1]), | |
(f[0][0]+f[0][2], f[0][1]+f[0][3]), | |
cv.CV_RGB(255, 0, 0), |