This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/598672/git-how-to-squash-the-first-two-commits | |
# Go back to the last commit that we want to form the initial commit (detach HEAD) | |
git checkout <sha1_for_B> | |
# reset the branch pointer to the initial commit, | |
# but leaving the index and working tree intact. | |
git reset --soft <sha1_for_A> | |
# amend the initial tree using the tree from 'B' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BinaryTree | |
class Node | |
attr_reader :word, :count, :left, :right | |
include Enumerable | |
def initialize(word) | |
@word, @count = word, 1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### MATPLOTLIBRC FORMAT | |
# This is a sample matplotlib configuration file - you can find a copy | |
# of it on your system in | |
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it | |
# there, please note that it will be overridden in your next install. | |
# If you want to keep a permanent local copy that will not be | |
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux | |
# like systems) and C:\Documents and Settings\yourname\.matplotlib | |
# (win32 systems). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding:utf-8 - *- | |
def load_dataset(): | |
"Load the sample dataset." | |
return [[1, 3, 4], [2, 3, 5], [1, 2, 3, 5], [2, 5]] | |
def createC1(dataset): | |
"Create a list of candidate item sets of size one." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generateRules(L, support_data, min_confidence=0.7): | |
"""Create the association rules | |
L: list of frequent item sets | |
support_data: support data for those itemsets | |
min_confidence: minimum confidence threshold | |
""" | |
rules = [] | |
for i in range(1, len(L)): | |
for freqSet in L[i]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BoyerMoore | |
attr_accessor :text | |
attr_reader :pattern, :matches | |
def initialize( opts ) | |
@text = opts[:text] | |
end | |
def search( pattern_str ) | |
@pattern = Pattern.new( pattern_str ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 適用於【鼠鬚管】0.9.13+ | |
# 位置:~/Library/Rime/squirrel.custom.yaml | |
# 用法:想要哪項生效,就刪去該行行首的#字符,但注意保留用於縮進的空格 | |
patch: | |
# us_keyboard_layout: true # 鍵盤選項:應用美式鍵盤佈局 | |
# show_notifications_when: growl_is_running # 狀態通知,默認裝有Growl時顯示,也可設爲全開(always)全關(never) | |
# style/horizontal: true # 候選窗横向顯示 | |
# style/inline_preedit: false # 非內嵌編碼行 | |
# style/font_face: "儷黑 Pro" # 我喜歡的字體名稱 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# default.custom.yaml | |
# save it to: | |
# ~/.config/ibus/rime (linux) | |
# ~/Library/Rime (macos) | |
# %APPDATA%\Rime (windows) | |
patch: | |
schema_list: | |
- schema: luna_pinyin # 朙月拼音 | |
- schema: luna_pinyin_simp # 朙月拼音 简化字模式 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rime alternative settings | |
# encoding: utf-8 | |
# | |
# difference from default settings: | |
# 1. ascii-style punctuation in half-shape mode | |
# 2. [ ] as paging keys | |
# | |
# save this file as: | |
# (Linux) ~/.config/ibus/rime/alternative.yaml | |
# (Mac OS) ~/Library/Rime/alternative.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
更新:建议编辑 ~/Library/Rime/squirrel.custom.yaml 文件,而不要在 squirrel.yaml 上做改动 | |
新版本加入了对边距宽高的订制,感谢作者 | |
patch: | |
us_keyboard_layout: true | |
style/horizontal: false | |
style/font_face: "Helvetica Neue" | |
style/font_point: 21 | |
style/corner_radius: 4 | |
style/border_height: 4 |
OlderNewer