-C 压缩数据传输
-f 后台登录用户名密码
-N 不执行shell[与 -g 合用]
-g 允许打开的端口让远程主机访问
-L 本地端口转发
-R 远程端口转发
-p ssh 端口
package main | |
import ( | |
"fmt" | |
"io" | |
"io/ioutil" | |
"log" | |
"code.google.com/p/go.crypto/ssh" | |
"code.google.com/p/go.crypto/ssh/terminal" |
# Aliases | |
alias g='git' | |
compdef g=git | |
alias gst='git status' | |
compdef _git gst=git-status | |
alias gl='git pull' | |
compdef _git gl=git-pull | |
alias gup='git fetch && git rebase' | |
compdef _git gup=git-fetch | |
alias gp='git push' |
# Create ssh directory if it doesn't exist | |
mkdir -p ~/.ssh | |
# Go to ssh directory | |
cd !$ | |
# Create public and private keys | |
ssh-keygen | |
# Upload your publick key to some server | |
cat ~/.ssh/id_rsa.pub | ssh user@host -p 22 "cat - >> ~/.ssh/authorized_keys" |
[Unit] | |
Description=supervisord - Supervisor process control system for UNIX | |
Documentation=http://supervisord.org | |
After=network.target | |
[Service] | |
Type=forking | |
ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf | |
ExecReload=/usr/bin/supervisorctl reload | |
ExecStop=/usr/bin/supervisorctl shutdown |
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from functools import wraps | |
def fib_direct(n): | |
assert n > 0, 'invalid n' | |
if n < 3: |
// A small SSH daemon providing bash sessions | |
// | |
// Server: | |
// cd my/new/dir/ | |
// #generate server keypair | |
// ssh-keygen -t rsa | |
// go get -v . | |
// go run sshd.go | |
// | |
// Client: |
import torndb | |
mysql_settings = { | |
'host': 'localhost:3306', | |
'user': 'user', | |
'password': 'password', | |
'database': 'database', | |
'time_zone': '-8:00', | |
'charset': 'utf8' |
#!/usr/bin/env python | |
# | |
# Copyright 2008-2014 Jose Fonseca | |
# | |
# This program is free software: you can redistribute it and/or modify it | |
# under the terms of the GNU Lesser General Public License as published | |
# by the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
# Based on post from: https://snipt.net/chrisdpratt/symmetrical-manytomany-filter-horizontal-in-django-admin/#L-26 | |
# Only reposting to avoid loosing it. | |
""" | |
When adding a many-to-many (m2m) relationship in Django, you can use a nice filter-style multiple select widget to manage entries. However, Django only lets you edit the m2m relationship this way on the forward model. The only built-in method in Django to edit the reverse relationship in the admin is through an InlineModelAdmin. | |
Below is an example of how to create a filtered multiple select for the reverse relationship, so that editing entries is as easy as in the forward direction. | |
IMPORTANT: I have no idea for what exact versions of Django this will work for, is compatible with or was intended for. |