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
require 'formula' | |
class Phash < Formula | |
homepage 'http://www.phash.org/' | |
url 'http://www.phash.org/releases/pHash-0.9.5.tar.gz' | |
#sha1 '9710b8a1d4d24e7fc3ac43c33eac8e89d9e727d7' | |
sha1 '87ce165b344bb859f5fdaf7c1776b556db3d8a15' | |
depends_on 'cimg' unless build.include? "disable-image-hash" and build.include? "disable-video-hash" | |
depends_on 'ffmpeg' unless build.include? "disable-video-hash" |
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
cd /usr/local/Library/Formula | |
vim phash.rb 将内容改为 https://gist.github.com/4343605 所示 | |
brew install phash --disable-video-hash --disable-audio-hash | |
git clone https://github.com/luchuan/py-phash.git | |
cd py-phash; python setup install |
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
luc:python-packages luc631$ brew install pHash | |
==> Installing phash dependency: cimg | |
==> Downloading http://downloads.sourceforge.net/cimg/CImg-1.5.2.zip | |
######################################################################## 100.0% | |
/usr/local/Cellar/cimg/1.5.2: 442 files, 33M, built in 51 seconds | |
==> Installing phash dependency: fftw | |
==> Downloading http://www.fftw.org/fftw-3.3.2.tar.gz | |
######################################################################## 100.0% | |
==> ./configure --enable-single --enable-sse --enable-shared --prefix=/usr/local/Cellar/fftw/3.3.2 --enable-threads | |
==> make install |
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
vagrant@vagrant:~/PyDoubanFM$ python fm.py | |
Playing: 12 Etudes - No 7. Pour les degres chromatiques | |
** (fm.py:11935): WARNING **: Command line `dbus-launch --autolaunch=3923027668d604d7c9a04edc0000011e --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n | |
** (fm.py:11935): WARNING **: Command line `dbus-launch --autolaunch=3923027668d604d7c9a04edc0000011e --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n | |
** (fm.py:11935): WARNING **: Command line `dbus-launch --autolaunch=3923027668d604d7c9a04edc0000011e --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n | |
** (fm.py:11935): WARNING **: Command line `dbus-launch --autolaunch=3923027668d604d7c9a04edc0000011e --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n |
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
#!/usr/bin/env python | |
# Copyright (c) 2011 Adam Pingel | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions | |
# are met: | |
# 1. Redistributions of source code must retain the above copyright | |
# notice, this list of conditions and the following disclaimer. |
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 | |
import pcap | |
import dpkt | |
from datetime import datetime | |
pc = pcap.pcap() | |
pc.setfilter('tcp port 80') | |
for ptime, pdata in pc: | |
print datetime.fromtimestamp(ptime).strftime('%Y-%m-%d %H:%M:%S')#, pdata | |
p = dpkt.ethernet.Ethernet(pdata) |
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
# ---------------------------------------------------------------------------- | |
# Makefile based on WinAVR Makefile Template written by Eric B. Weddington, | |
# Jörg Wunsch, et al. | |
# | |
#---------------------------------------------------------------------------- | |
# On command line: | |
# | |
# make all = Make software. | |
# | |
# make clean = Clean out built project files. |
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
// Playground - noun: a place where people can play | |
import Cocoa | |
func main() { | |
func _fib(x: Int, y: Int, i: Int) -> Int { | |
if i == 1 || i == 0 { |
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
Process: Xcode [46662] | |
Path: /Applications/Xcode6-Beta.app/Contents/MacOS/Xcode | |
Identifier: com.apple.dt.Xcode | |
Version: 6.0 (6194.21) | |
Build Info: IDEFrameworks_KLONDIKE-6194021000000000~12 | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [901] | |
Responsible: Xcode [46662] | |
User ID: 501 |
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 | |
from random import randint, sample | |
from collections import Counter | |
from itertools import combinations | |
def gen_carts(items, n_cart): | |
n_items = len(items) | |
carts = [] | |
with open('carts.txt', 'w') as f: |
OlderNewer