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: utf8 | |
''' | |
对于图片相似度比较有很多方法,我们这以RGB直方图为例。 | |
我们以一种规则,使得每个图片生成一组描述的特征向量。 | |
opencv的直方图比较函数我们可以巧妙的利用,其有若干比较规则,但只支持直方图的数据结构,我们可以将特征向量拟合成直方图的数据结构,然后使用其的相似度比较函数。 | |
具体的数学计算方法有兴趣的可以看opencv的官方教程,这里我们期望生成百分比形式的相似度参数,所以使用CV_COMP_CORREL | |
以下是代码,以python编写 | |
''' | |
import cv2.cv as cv |
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
#Create git user account | |
sudo adduser --shell $(which git-shell) --gecos 'git version control' --disabled-password git | |
sudo addgroup developers | |
#Add git user to the appropriate groups | |
sudo usermod -a -G www-data git | |
sudo usermod -a -G developers git | |
#Setup authorized_keys file for access |
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
import os | |
import fcntl, termios, struct, os | |
def getTerminalSize(): | |
env = os.environ | |
def ioctl_GWINSZ(fd): | |
try: | |
cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,'1234')) | |
except: | |
return |
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
# sudo apt-get install libwxgtk2.8-dev | |
# install erlang observer | |
KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --enable-shared-zlib --enable-dynamic-ssl-lib --enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --with-wx" | |
kerl build R16B02 r16b02.wx | |
kerl install r16b01.wx ~/erlang/r16b02wx | |
erl -s observer start |
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
package main | |
import ( | |
"bytes" | |
"fmt" | |
"log" | |
"os/exec" | |
) | |
func main() { |
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
# maybe need to stop the rabbit server first | |
# invoke-rc.d rabbitmq-server stop | |
# sudo echo "deb http://www.rabbitmq.com/debian/ testing main" >> /etc/apt/sources.list # this line will cause error | |
cd | |
mkdir temp | |
cd temp | |
wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | |
sudo apt-key add rabbitmq-signing-key-public.asc |
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
sudo apt-get install protobuf-compiler libprotobuf-dev libprotoc-dev | |
git clone https://github.com/protobuf-c/protobuf-c | |
cd protobuf-c | |
./autogen.sh | |
make | |
sudo 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
# Install GCC 4.7.3 | |
sudo apt-add-repository ppa:ubuntu-sdk-team/ppa | |
sudo apt-get update | |
sudo apt-get install -y build-essential | |
# Install CMake 2.8.10.1 | |
sudo apt-get install -y cmake cmake-curses-gui | |
wget http://netcologne.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.5/opencv-2.4.5.tar.gz | |
tar -xf opencv-2.4.5.tar.gz |
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
sudo apt-get install -y build-essential | |
sudo apt-get install -y mesa-common-dev | |
wget http://download.qt-project.org/official_releases/qt/5.0/5.0.2/qt-linux-opensource-5.0.2-x86-offline.run | |
chmod +x qt-linux-opensource-5.0.2-x86-offline.run | |
./qt-linux-opensource-5.0.2-x86-offline.run |
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 | |
""" | |
Very simple HTTP server in python. | |
Usage:: | |
./dummy-web-server.py [<port>] | |
Send a GET request:: | |
curl http://localhost |
NewerOlder