写在前面

最近给自己的本子换了新的ssd,也趁此机会重装了系统。本次选的的系统是xubuntu 14.04。

嗯,目前来看,这货比ubuntu快的多,用着很爽~

下面将新系统配置当中遇到的一些问题和技巧做个记录,也方便以后查询~

1.将程序添加到开始菜单

由于需要配置android开发环境,很自然的就装了Eclispe-adt,装完后,没有开始菜单启动项,感觉不太方便。

Google之后,发现将程序添加到开始菜单中其实非常简单。

编辑文件:

sudo vim /usr/share/applications/Eclipse-adt.desktopktop

配置如下:

[Desktop Entry]
Version=1.0
Type=Application
Name=Eclipse-adt
Comment=Eclipse ADT Bundle
Icon=/home/brant/Development/Android/adt-bundle/eclipse/icon.xpm
Exec=/home/brant/Development/Android/adt-bundle/eclipse/eclipse
Path=
Terminal=false
StartupNotify=true
Categories=Development;IDE

2.github ssh提交

参考https://help.github.com/articles/generating-ssh-keys/

git remote set-url origin git@github.com:username/repo.git

3.S权限介绍

引用如下:

'S' = The directory's setgid bit is set, but the execute bit isn't set.

's' = The directory's setgid bit is set, and the execute bit is set.

SetGID = When another user creates a file or directory under such a setgid directory, the new file or directory will have its group set as the group of the directory's owner, instead of the group of the user who creates it.

To remove the setGID bit:

chmod g-s eclipse/
Taken from man chmod:

You can set or clear the bits with symbolic modes like u+s and g-s, and you can set (but not clear) the bits with a numeric mode.

link to a similar question: http://unix.stackexchange.com/questions/27250/uppercase-s-in-permissions-of-a-folder

4.其他技巧

修改eclispe tab-bar字体

修改文件:

/home/brant/Development/Android/adt-bundle/eclipse/plugins/org.eclipse.platform_4.2.2.v201302041200/css

Raid 1+0 操作步骤记录

2014-03-11 by Brant Xiong

操作结果

所有机器磁盘挂载情况如下:

[root@HOST work]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             8.2G  3.8G  4.4G  47% /
/dev/sda3             1.8T  1.7G  1.8T   1% /home
/dev/md10             8.9T  168M  8.4T   1% /home/data1

1. unmount正在使用的盘

for x in `seq 1 ...
read more

记一次捉急的文本处理

2014-02-19 by Brant Xiong

前言

今天要需要统计10w个query的页面构成,由于输入文件格式不标准,url编码不统一等各种问题,整个统计过程相当纠结...下面将其中的一些点记录下来,供以后参考

异常文件处理

删除文件最后的异常行:

for file in `ls`; do line=`tail -1 $file`; if [ "$line" != "}," ]; then sed -i '$d' $file;fi;done

删除目录下的空文件:

find -maxdepth 1 -type f -empty -print0 | xargs -0 rm -f

python处理url

从url中获取domain name:

1
2
3
4
5
6
#!/usr/bin ...
read more

tcpdump用法简介

2014-02-18 by Brant Xiong

前言

今天在追查问题时,需要转包分析,用到了tcpdump工具,下面做下记录~

基本用法

tcpdump 采用命令行方式,需以root权限运行,它的命令格式为:

tcpdump [ -adeflnNOpqStvx ] [ -c 数量 ] [ -F 文件名 ]
        [ -i 网络接口 ] [ -r 文件名] [ -s snaplen ]
        [ -T 类型 ] [ -w 文件名 ] [表达式 ]

简单用法:

tcpdump -i eth1 port 8001
#查看localhost数据包
tcpdump -i lo port 8001

将结果写入文件:

tcpdump -i lo -nn port 8001 -w dump

显示http header ...

read more

利用tc工具做限速

2014-02-17 by Brant Xiong

前言

有关tc的介绍,可以参见tc

tc的使用

tc封装的脚本

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#a simple example for "tc"
#set the param
PORT=$2
DELAY ...
read more
Follow me on GitHub