Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| _complete_ssh_hosts () | |
| { | |
| COMPREPLY=() | |
| cur="${COMP_WORDS[COMP_CWORD]}" | |
| comp_ssh_hosts=`cat ~/.ssh/known_hosts | \ | |
| cut -f 1 -d ' ' | \ | |
| sed -e s/,.*//g | \ | |
| grep -v ^# | \ | |
| uniq | \ | |
| grep -v "\[" ; |
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
| #!/bin/bash | |
| # | |
| # DESCRIPTION: | |
| # | |
| # Set the bash prompt according to: | |
| # * the active virtualenv | |
| # * the branch/status of the current git repository | |
| # * the return value of the previous command | |
| # * the fact you just came from Windows and are used to having newlines in | |
| # your prompts. |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| #!/usr/bin/env python | |
| ''' | |
| Automatically estimate insert size of the paired-end reads for a given SAM/BAM file. | |
| Usage: getinsertsize.py <SAM file> or samtools view <BAM file> | getinsertsize.py - | |
| Author: Wei Li | |
| Copyright (c) <2015> <Wei Li> | |
| import json | |
| import datetime | |
| from decimal import Decimal | |
| from mongoengine.queryset import queryset_manager | |
| from mongoengine.queryset import QuerySet | |
| from mongoengine.base import BaseList, BaseDict, ObjectId | |
| def list_encoder(inst, obj, field, force_string=False): | |
| """ |
Use magit-ediff or 'e' on an unmerged item to resolve merge conflicts with ediff. Magit will set up an ediff with three buffers A, B and C. A and B are the original (conflicting) files, and C is the conflicted merge.
Use 'n'/'p' to move to the next/previous conflict, use 'a'/'b' to choose which changes (those in a A or B) should be the ones to keep in the merged file.
You can always just switch to buffer C and edit what the merged version should look like.
| #! /bin/sh | |
| usage_error () { | |
| echo 'Usage: sh migrator.sh <path to sqlite_to_postgres.py> <path to sqlite db file> <an empty dir to output dump files>' | |
| echo | |
| echo 'Example:' | |
| echo '>sh migrator.sh sqlite_to_postgres.py ~/reviewboard.db /tmp/dumps' | |
| echo | |
| echo 'Tested on:' | |
| echo 'Python 2.7.3' |
先前在《開源應用程式架構》 一書中,我介紹了 SocialCalc 這個在瀏覽器中運行的試算表編輯器,以取代伺服器為中心的 WikiCalc 架構。SocialCalc 在瀏覽器中執行所有的運算,只有在載入和儲存試算表時才會使用伺服器。
追求效能是 Socialtext 團隊在 2006 年時設計 SocialCalc 的主要目的。重點在於:在 JavaScript 環境下執行客戶端運算,儘管在當年的速度僅有伺服器端 Perl 運算的十分之一,但仍然勝過 AJAX 來回傳輸資料造成的網路延遲: