Skip to content

Instantly share code, notes, and snippets.

View staticor's full-sized avatar

SteveYagn staticor

View GitHub Profile
@gtzilla
gtzilla / merge commits git
Created January 25, 2011 07:15
instructions I need to merge git commits together
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'
@yuya-takeyama
yuya-takeyama / binarytree.rb
Created February 5, 2011 14:32
Binary Tree implemented in Ruby.
module BinaryTree
class Node
attr_reader :word, :count, :left, :right
include Enumerable
def initialize(word)
@word, @count = word, 1
end
@huyng
huyng / matplotlibrc
Created February 8, 2011 15:50
my default matplotlib settings
### 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).
#-*- 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."
@marcelcaraciolo
marcelcaraciolo / Apriori_rules.py
Created December 4, 2011 18:04
apriori_rules.py
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]:
@vincentchu
vincentchu / boyer_moore.rb
Created February 12, 2012 04:46
Boyer Moore implemented in Ruby
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 )
@lotem
lotem / squirrel.custom.yaml
Last active March 12, 2024 11:51
【鼠鬚管】定製檔
# 適用於【鼠鬚管】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" # 我喜歡的字體名稱
@lotem
lotem / default.custom.yaml
Last active January 25, 2024 08:47
在Rime輸入方案選單中添加五筆、雙拼、粵拼、注音,保留你需要的
# 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 # 朙月拼音 简化字模式
@lotem
lotem / alternative.yaml
Created April 8, 2012 03:44
Rime 別樣設定,使用西文標點、[ ] 鍵換頁
# 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
@NemoAlex
NemoAlex / gist:2879405
Created June 6, 2012 02:07
Squirrel 配色方案修改
更新:建议编辑 ~/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