分享一个软件
Tickeys - / 找对打字的感觉 /
Links:Tickeys
简单的说就是可以让你在打字的时候,模拟发出各种声音,比如 Cherry-G80
听起来有点矫情,但是用的时候感觉还挺有意思,确实可以『找对打字的感觉』—— 尤其是敲代码的时候。
相比听雨声白噪音是更有趣的体验。
一个国内独立 Mac APP 作者的作品,去试试吧。
分享一个软件
Tickeys - / 找对打字的感觉 /
Links:Tickeys
简单的说就是可以让你在打字的时候,模拟发出各种声音,比如 Cherry-G80
听起来有点矫情,但是用的时候感觉还挺有意思,确实可以『找对打字的感觉』—— 尤其是敲代码的时候。
相比听雨声白噪音是更有趣的体验。
一个国内独立 Mac APP 作者的作品,去试试吧。
root@vultr:~# docker run -p 9001:9001 --rm jrief/myshop-sample:latest
FATA[0001] Error response from daemon: Cannot start container 9df8acbd0faa83ccaa75f00def27a6950b66f91f96d280835952e5bb566b573f: [8] System error: mountpoint for devices not found解决办法是
root@vultr:~# apt-get install cgroup-lite环境是
Ubuntu 14.04 amd-64 server 版
Docker version 1.6.2, build 7c8fca2
因为是全新的系统,环境很干净,应该还是官方包依赖的问题。记下来免得下次翻找。
晚安。
more details: http://unix.stackexchange.com/questions/249425/cant-run-docker-hello-world-mountpoint-for-devices-not-found
sudo chgrp admin /dev/bpf*
sudo chmod g+rw /dev/bpf* mkvirtualenv project_namermvirtualenv project_namesetvirtualenvproject project_name PATHworkon project_namedeactivedjango-admin.py startproject project_namepython manage.py migratepython manage.py runserverpython manage.py startapp app_name
在project_name的settings.py文件中,找到INSTALLED_APPS列表,在列表的最后面增加 app_name
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'app_name',
]在app_name目录内的views.py文件中,删除注释# Create your views here.,创建视图
def index(request):
context_dict = {'boldmessage': "I am bold font from the context"}
return render(request, 'rango/index.html', context_dict)在app_name目录中,创建一个叫做urls.py的文件。
from django.conf.urls import patterns, url
from rango import views
urlpatterns = [
url(r'^$', views.index, name='index')]在project_name/project_name/urls.py中,更新urlpatterns列表。
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^app_name/', include('app_name.urls')) # for example
]在project_name/创建一个templates目录,在这个目录中为每一个 app 建立一个目录,例如 project_name/templates/app_name,用来存放app_name应用下的模板
在setting.py中创建TEMPLATE_PATH变量,用它来储存 templates 目录。这里我们使用os.path.join()函数。
TEMPLATE_PATH = os.path.join(BASE_DIR, 'templates')TEMPLATE_DIRS = [
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
TEMPLATE_PATH,
]在template/app_name/目录里建立一个叫做index.html的文件,在新文件里加入下面代码:
<!DOCTYPE html>
<html>
<head>
<title>App</title>
</head>
<body>
<h1>App says...</h1>
hello world! <strong>{{ boldmessage }}</strong><br />
<a href="/app_name/about/">About</a><br />
</body>
</html>from django.shortcuts import render
def index(request):
# Construct a dictionary to pass to the template engine as its context.
# Note the key boldmessage is the same as {{ boldmessage }} in the template!
context_dict = {'boldmessage': "I am bold font from the context"}
# Return a rendered response to send to the client.
# We make use of the shortcut function to make our lives easier.
# Note that the first parameter is the template we wish to use.
return render(request, 'rango/index.html', context_dict)在settings.py文件,我们需要更新两个变量STATIC_URL和STATICFILES_DIRS元组,像下面一样创建一个储存静态目录(STATIC_PATH)的变量。
STATIC_PATH = os.path.join(BASE_DIR,'static')
STATIC_URL = '/static/' # You may find this is already defined as such.
STATICFILES_DIRS = [
STATIC_PATH,
]<!DOCTYPE html>
{% load static %} <!-- New line -->
<html>
<head>
<title>Rango</title>
</head>
<body>
<h1>App says...</h1>
hello world! <strong>{{ boldmessage }}</strong><br />
<a href="/app_name/about/">About</a><br />
<img src="{% static "images/appp.jpg" %}" alt="Picture of App" /> <!-- New line -->
</body>
</html>在settings.py里添加一个叫做DATABASES的字典
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}class Category(models.Model):
name = models.CharField(max_length=128, unique=True)
def __unicode__(self): #For Python 2, use __str__ on Python 3
return self.name
class Page(models.Model):
category = models.ForeignKey(Category)
title = models.CharField(max_length=128)
url = models.URLField()
views = models.IntegerField(default=0)
def __unicode__(self): #For Python 2, use __str__ on Python 3
return self.title打开rango/admin.py输入如下代码:
from django.contrib import admin
from rango.models import Category, Page
admin.site.register(Category)
admin.site.register(Page)makemigrations app_name$ python manage.py makemigrations rango
Migrations for 'rango':
0001_initial.py:
- Create model Category
- Create model Pagemigrate$ python manage.py migrate
Operations to perform:
Apply all migrations: admin, rango, contenttypes, auth, sessions
Running migrations:
Applying rango.0001_initial... OK在Django中创建数据驱动页面必须执行以下5步。
views.py文件中导入你要添加的模型。ssh-keygen -t rsa把公钥id_rsa.pub复制到远程机器的 /home/username/.ssh目录并命名为authorized_keys
brew install ssh-copy-id 安装 ssh-copy-idssh-copy-id user@host;cat ~/.ssh/id_rsa.pub | ssh user@host "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"虽然不用输入密码了,但是还得 ssh username@hostname 来登陆,再简洁一点:
修改本地登陆用户的 ~/.ssh/config 文件,如果木有的话就自个儿建一个吧,内容如下:
Host theoden
user liluo
Host fili
user liluo
Host hostname
user name这样,本地和远程登陆用户名不一致也可以 ssh hostname 登陆了。