Skip to content

Instantly share code, notes, and snippets.

#-*- 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."
PREFIX=$HOME
VERSION=1.2.3
# Install Protocol Buffers
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2
tar -xf protobuf-2.4.1.tar.bz2
cd protobuf-2.4.1
./configure --prefix=$PREFIX
make
make install
#NOTE: .pydistutils.cfg seems to be not compatible with brew install python
#areas I needed to clean before installation
#clean up ~/Library/Python
#clean up .local
brew install python --framework
easy_install pip
pip install virtualenv
pip install virtualenvwrapper
mkdir $HOME/.virtualenvs
@frank4565
frank4565 / plus 1 without add or minus sign.
Created May 15, 2013 09:38
输入一个数x,不采用加号或减号,返回x+1的值(微软实习生面试)
(x & 1) ? (x << 1 | 1) & ~x : (x | 1);
// by 烧掉回忆 http://www.dewen.org/q/12697#ans23348

Alias an Apache web directory to a git repository.

  1. Open httpd.conf.
  2. Find <IfModule alias_module> ... </IfModule> block.
  3. Add Alias <url-path> <path-in-git-repository>. Change the <url-path> to whatever you want to show in url. e.g. If you want the whole url be www.example.com/auto/, the set <url-path> to be /auto/. Change the <path-in-git-repository> to the path where your server code exists under the git repostory.
  4. Add the following to the last line you added.
    <Directory <path-in-git-repository> >
    Order allow,deny
    
@frank4565
frank4565 / MultipleLineOmniFocus.py
Last active March 25, 2018 08:15
Send Multiple Tasks to OmniFocus at Once with Drafts and Pythonista or one task with Launch Center Pro. Supported Chinese. (Other Unicode characters should also work.)
# -*- coding: utf-8 -*-
# More information: Send Multiple Tasks to OmniFocus at Once with Drafts and Pythonista or one task with Launch Center Pro. Supported Chinese. (Other Unicode characters should also work.)
# Script name: MultiLineOmniFocus
# Drafts "URL Action": pythonista://MultiLineOmniFocus?action=run&argv=[[draft]]%0Adrafts
# Launch Center Pro: pythonista://MultiLineOmniFocus?action=run&args={{[prompt:New Item]}}%0Alaunchpro
# or Install from http://launchcenterpro.com/tdp7fb
# Modified from email script by OMZ: ImageMail
# Modified from script by @Thinkbond from Zhihu.com (http://www.zhihu.com/question/20888606/answer/17093178)
# Inspired by http://n8henrie.com/2013/03/send-multiple-tasks-to-omnifocus-at-once-with-drafts-and-pythonista
@frank4565
frank4565 / Safari.css
Created October 24, 2013 05:15
解决 Mavericks Safari 字体发虚问题
body {-webkit-font-smoothing: subpixel-antialiased !important; }
QuickLookJSON.qlgenerator
CC_QL.qlgenerator
QLStephen.qlgenerator
QLColorCode.qlgenerator
QLMarkdown.qlgenerator
ScriptQL.qlgenerator
DICOMQuickLook.qlgenerator
ProcessingQL.qlgenerator
Archive.qlgenerator
GBQLGenerator.qlgenerator
@frank4565
frank4565 / squid-launch
Created October 26, 2013 08:08
Squid Launch Script in /etc/init.d for OpenWRT
#!/bin/sh /etc/rc.common
# Example script
# Copyright (C) 2007 OpenWrt.org
START=99
STOP=99
start() {
echo start
# commands to launch application - PLEASE DO YOUR PATH IN HERE
# this is my PATH - different from the tutorial above
@frank4565
frank4565 / squid.conf
Last active February 20, 2022 14:12
Squid configuration file for APN Proxy.
visible_hostname localhost
cache_mgr [email protected]
http_port 3128 transparent
icp_port 0
dns_nameservers 192.168.1.1
cache_effective_user git
cache_effective_group git
pid_filename /tmp/squid.pid
emulate_httpd_log on
#logformat log %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh