分类目录归档:Tools

wine中文字体美化

sudo yum install wqy*

vim ~/font.reg

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Lucida Sans Unicode"="wqy-microhei.ttc"
"Microsoft Sans Serif"="wqy-microhei.ttc"
"MS Sans Serif"="wqy-microhei.ttc"
"Tahoma"="wqy-microhei.ttc"
"Tahoma Bold"="wqy-microhei.ttc"
"SimSun"="wqy-microhei.ttc"
"Arial"="wqy-microhei.ttc"
"Arial Black"="wqy-microhei.ttc"
[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="2"
"FontSmoothingType"=dword:00000002
"FontSmoothingGamma"=dword:00000578
"FontSmoothingOrientation"=dword:00000001
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
"ClientSideAntiAliasWithCore"="Y"
"ClientSideAntiAliasWithRender"="Y"
"ClientSideWithRender"="Y"

wine regedit,选择导入,重新开启应用

使用vagrant快速搭建MariaDB Galera Cluster集群测试环境

参考

下载并安装ubuntu 12.04的32位box 初始化vagrant box

wget http://files.vagrantup.com/precise32.box
vagrant box add base Downloads/precise32.box
vagrant init

设置最大内存512

vim ~/VagrantFile

config.vm.provider :virtualbox do |vb|
    # Don't boot with headless mode
    vb.gui = false

    # Use VBoxManage to customize the VM. For example to change memory:
    vb.customize ["modifyvm", :id, "--memory", "512"]
end

配置虚拟IP

config.vm.network :private_network, ip: "10.0.1.100"

启动虚拟机修改为163源

启动虚拟机,并通过ssh登录到客户机

vagrant up
vagrant ssh

采用163.com的源

sudo vim /etc/apt/sources.list

deb http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

更新源

sudo aptitude update

添加mariadb源,并安装集群版

大部分linux的二进制发行包都可以在这里找到:https://downloads.mariadb.org/mariadb/repositories/

apt-get install python-software-properties
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://mirrors.tuna.tsinghua.edu.cn/mariadb/repo/5.5/ubuntu precise main'
sudo aptitude update
sudo aptitude install mariadb-galera-server mariadb-client

打包虚拟机,以便再次安装 退出客户机,回到主机界面

vargrant package --output galera-db.box
vargant box add db galera-db.box

配置虚拟机

vim ~/Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.provision "shell", inline: "echo Hello"
  config.vm.define "db1" do |db1|
    db1.vm.box = "db"
    db1.vm.network :private_network, ip: "10.0.1.100"
  end

  config.vm.define "db2" do |db2|
    db2.vm.box = "db"
    db2.vm.network :private_network, ip: "10.0.1.101"
  end
end

重新加载虚拟机配置

vagrant reload

配置第一台db节点

vagrant ssh db1
sudo service mysql start
sudo mysql_secure_installation mysql -uroot -p

mysql> GRANT USAGE ON *.* to sst@'%' IDENTIFIED BY 'sstpass123';
mysql> GRANT ALL PRIVILEGES on *.* to sst@'%';
mysql> FLUSH PRIVILEGES;
mysql> quit

sudo cp /usr/share/mysql/wsrep.cnf /etc/mysql/conf.d/ sudo vim /etc/mysql/conf.d/wsrep.cnf

wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://"
wsrep_sst_auth=sst:sstpass123
wsrep_sst_method=rsync
wsrep_node_name=db1
wsrep_node_address=10.0.1.100

sudo service mysql restart

安装第二个节点

vagrant ssh db2

除了wsrep.cnf有少许不同外,其他同第一节点

wsrep_cluster_address="gcomm://10.0.1.100"
wsrep_node_name=db2
wsrep_node_address=10.0.1.101

sudo service mysql restart

测试节点同步

mysql -usst -psstpass123 -h10.0.1.100 show status like 'wsrep%'; 可以看到wsrep_connected都为ON

create database testdb;
use testdb;
create table t(id int primary key auto_increment);
insert into t values(null);
insert into t values(null);
select * from t;
exit;

mysql -usst -psstpass123 -h10.0.1.101

use testdb;
select * from t;
insert into t values(null);
insert into t values(null);
select * from t;

参考:

使用vagrant快速搭建phalcon开发环境

vagrant是一款开发环境快速搭建的工具,phalcon是一个c语言的php框架。

参考:

http://www.vagrantup.com/

http://phalconphp.com/en/download/vagrant

下载并安装vagrant

http://www.vagrantup.com/downloads.html

支持windows,linux,mac

下载并启动phalcon镜像

vagrant init phalconbox https://s3-eu-west-1.amazonaws.com/phalcon/phalcon125-apache2-php54-mysql55.box
vagrant up

在fedora下安装xmind

下载xmind的deb包:http://www.xmind.net/download/linux/,然后

yum install alien.noarch
sudo alien --scripts -r xmind-linux-3.4.1.201401221918_amd64.deb
sudo yum localinstall xmind-3.4.1-2.x86_64.rpm

也可以直接下载支持所有平台的绿色便携包(不会自动创建桌面快捷方式):http://www.xmind.net/download/portable/

ubuntu下使用bind9+mount+nginx搭建企业统一开发环境

公司内部项目较多,希望搭建一个内部环境,满足以下需求:

  1. 每次有新的项目可以不用修改host文件,产品及测试随时查看开发进度(企业内dns解析)
  2. 前端开发人员不用做复杂的服务器配置(mount+virtualhost)

安装bind9

sudo apt-get install bind9 bind9-doc bind9-host bind9utils dnsutils

开启dns缓存(可选)
sudo vim /etc/bind/named.conf.options(dns缓存)

forwarders {
  8.8.8.8;
  202.96.134.133;
  202.96.128.166;
};

增加一个域名
sudo vim /etc/bind/named.conf.local

zone "shining.dev" {
   type master;
   file "/etc/bind/db.shining.dev";
};

域名配置
sudo cp /etc/bind/db.local /etc/bind/db.shining.dev
sudo vim /etc/bind/db.shining.dev

$TTL	604800
@	IN	SOA	localhost. root.localhost. (
			      2		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
;
@  IN  NS  localhost.
@  IN  A  10.1.0.21
*.shining.dev.  IN  A  10.1.0.21

启动&开机自动启动bind9

sudo chkconfig bind9 on
sudo service bind9 start

linux开启共享

sudo apt-get install samba
sudo vim /etc/samba/smb.conf

[share]
comment = share
path = /home/ning/project
browseable = yes
guest ok = yes
writable = yes

sudo chkconfig samba on
sudo service samba start