Linux SS5 socks 代理服务器安装

1. 配置 Socks5 编译环境

2. 安装 Socks5 必要的包

3.下载,编译安装 Socks5 
到此下载 http://sourceforge.net/projects/ss5/files/

http://ss5.sourceforge.net/

官方实例

http://ss5.sourceforge.net/examples.htm

有点 BUG 需要我们手工修正一下
# vi /etc/rc.d/init.d/ss5 找到38行

改为

# vi /etc/rc.d/init.d/ss5 找到40行

改成

看下我修改后的对比

143A02955-2.jpg

143A02955-2.jpg

4. 启动ss5服务

5. 添加 ss5 到服务中,并随机启动

6. 删除Socks V4模块
改名为 mod_socks4.so.bk

7. 添加 SS5 用户
ss5 默认使用1080端口,并允许任何人使用。
我们可以修改 /etc/opt/ss5/ss5.conf 中的

/etc/opt/ss5/ss5.passwd 中添加 用户名和密码如:

8. 设置允许范围

143A02955-2.jpg

使用用户验证,重启ss5服务

8. 查看日志

ss5正常启动后,如果你使用的是10800(非默认端口),这时会发现1080和10800都开的了,

这时你需要去环境变量里手工指定端口

Centos/Ubuntu FTP服务器的架设和配置

1.安装命令
Centos

Ubuntu

2.启动/重启/关闭vsftpd服务器
Centos

Ubuntu

OK表示重启成功了.
启动和关闭分别把restart改为start/stop即可.
如果是源码安装的,到安装文件夹下找到start.shshutdown.sh文件,执行它们就可以了.

3.与vsftpd服务器有关的文件和文件夹
vsftpd服务器的配置文件的是: /etc/vsftpd/vsftpd.conf
如果系统是Ubuntu,则配置文件在/etc/vsftpd.conf
vsftpd服务器的根目录,即FTP服务器的主目录:
/var/ftp
如果你想修改服务器目录的路径,那么你只要修改/var/ftp到别处就行了

4.添加FTP本地用户
有的FTP服务器需要用户名和密码才能登录,就是因为设置了FTP用户和权限.
FTP用户一般是不能登录系统的,只能进入FTP服务器自己的目录中,这是为了安全.这样的用户就叫做虚拟用户了.实际上并不是真正的虚拟用户,只是不能登录SHELL了而已,没能力登录系统.

这个命令的意思是:
使用命令(adduser)添加test用户,不能登录系统(-s /sbin/nologin),自己的文件夹在(-d /opt/test_ftp)),属于组ftp(-g ftp)
然后你需要为它设置密码 passwd test
这样就添加了一个FTP用户了.下面的示例可以帮助你进入FTP服务器了.

Windows中,只要在浏览器中输入 ftp://192.168.0.33 进入FTP服务器,然后 右键 登录,输入用户名和密码就可以登录自己的目录了.

当然你要保证自己能读写自己的目录,就要在配置文件vsftpd.conf里设置一下就可以读写了.

5.匿名上传下载

修改配置文件即可vsftpd.conf,确定有以下几行,没有自己添加进去就可以了.

然后你可以新建一个文件夹,修改它的权限为完全开放,任何用户就可以登录这个文件夹,并上传下载文件:

6.定制进入FTP服务器的欢迎信息

vsftpd.conf文件中设置:

然后进入用户目录建立一个.message文件,输入欢迎信息即可(我这里写入的是Welcome to gxlinux's FTP!):

7.实现虚拟路径

将某个目录挂载到FTP服务器下供用户使用,这就叫做虚拟路径.
比如将gxl用户的目录挂载到FTP服务器中,供FTP服务器的用户使用,使用如下命令即可:

8.打开vsFTPd的日志功能

添加下面一行到vsftpd.conf文件中,一般情况下该文件中有这一行,只要把前面的注释符号#去掉即可,没有的话就添加,或者修改:

9.限制链接数,以及每个IP最大的链接数

修改配置文件中,例如vsftp最大支持链接数100个,每个IP能支持5个链接:

10.限制传输速度

修改配置文件中,例如让匿名用户和vsftd上的用户(即虚拟用户)都以80KB=1024*80=81920的速度下载

11.将用户(一般指虚拟用户)限制在自家目录

修改配置文件中,这样用户就只能访问自己家的目录了:

如果只想某些用户仅能访问自己的目录,其它用户不做这个限制,那么就需要在chroot_list文件(此文件一般是在/etc/vsftpd/中)中添加此用户.

编辑此文件,比如将test用户添加到此文件中,那么将其写入即可.一般的话,一个用户占一行.

12.绑定某个IPvsFTPd

有时候要限制某些IP访问服务器,只允许某些IP访问,例如只允许192.168.0.33访问这个FTP,同样修改配置文件:

虚拟用户其他设置
/etc/vsftpd/vsftpd.chroot_list文件中写入允许登陆的虚拟用户名称,每行一个
/etc/vsftpd/vsftpd_user_conf文件夹中创建一个以虚拟用户用户名命名的文件,
写入:local_root = /var/FTP/子目录名
然后在/var/FTP下创建一个对应的目录即可

13.Ubuntu下开启SSL支持,使用SFTP来访问

/etc/vsftpd.conf 文件的

后面增加

然后重启vsftpd

此时使用的是系统默认的证书,如果要设置自己的证书,修改

为自己证书的路径就可以了。

FileZilla在配置的协议中选择 “SFTP-SSH File Transfer Protocol”就可以正常登陆了。

14.特别配置

如果在配置文件中,设置listen=NO,并且开启设置chroot_local_user=yes,那么可以使用SSH的登录端口来使用FTP功能,这样可以减少一个端口的暴露。如果设listen=YES,则会增加一个端口专门来接受来自FTP端口的请求。默认端口是21。可以通过配置文件的listen_port来修改。

参考链接


centos FTP服务器的架设和配置

VirtualBox压缩VDI格式硬盘/调整磁盘大小

首先,看 vbox的官方文档:

http://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvdi

  • With the --compact option, can be used to compact disk images, i.e. remove blocks that only contains zeroes. This will shrink a dynamically allocated image again; it will reduce the physical size of the image without affecting the logical size of the virtual disk. Compaction works both for base images and for diff images created as part of a snapshot.For this operation to be effective, it is required that free space in the guest system first be zeroed out using a suitable software tool. For Windows guests, you can use the sdelete tool provided by Microsoft. Executesdelete -z in the guest to zero the free disk space before compressing the virtual disk image. For Linux, use the zerofree utility which supports ext2/ext3 filesystems.Please note that compacting is currently only available for VDI images. A similar effect can be achieved by zeroing out free blocks and then cloning the disk to any other dynamically allocated format. You can use this workaround until compacting is also supported for disk formats other than VDI.

关键之处正在于 sdelete 应该使用 -c -z  两个选项 ,而网上所以的方法都说是使用 -c 选项。

 Using SDelete

SDelete is a command line utility that takes a number of options. In any given use, it allows you to delete one or more files and/or directories, or to cleanse the free space on a logical disk. SDelete accepts wild card characters as part of the directory or file specifier.

所以,总结一下,正确的方法应该是这样:

  1. 在guest os 中清理系统, windows的话可以再硬盘碎片整理一下
  2. 在 guest os 中 Windows 执行 sdelete -z -cLinux/Debian/Ubuntu 启动到Recovery Mode执行 zerofree /dev/sdaX
  3. VBoxManage modifyhd <uuid>|<filename>  --compact

如果磁盘空间不足,使用如下命令调整(增大/加大)磁盘空间

参考链接


android之StrictMode介绍

Android 2.3起,新增加了一个新的类,叫StrictMode(android.os.StrictMode)。这个类可以用来帮助开发者改进他们编写的应用,并且提供了各种的策略,这些策略能随时检查报告开发者开发应用中存在的问题,比如可以监视那些本不应该在主线程中完成的工作或者其他的一些不规范和不好的代码。

StrictMode的策略和规则

  目前,有两大类的策略可供使用

一类是关于常用的监控方面的

Disk Reads 磁盘读

Disk Writes 磁盘写

Network access 网络访问

Custom Slow Code 自定义的运行速度慢的代码分析

前面三种的意思读者应该很清楚,就是正如它们的名字所示,分别对磁盘的读和写,网络访问进行监控。而第四种的自定义慢代码分析,是仅当访问调用类的时后才触发的,可以通过这种

方法去监视运行缓慢的代码。当在主线程中调用时,这些验证规则就会起作用去检查你的代码。比如,当你的应用在下载或者解析大量的数据时,你可以触发自定义运行速度慢代码的查询分、

析,作用很大。StrictMode可以用于捕捉发生在应用程序主线程中耗时的磁盘、网络访问或函数调用,可以帮助开发者使其改进程序,使主线程处理UI和动画在磁盘读写和网络操作时变得更平

滑,避免主线程被阻塞的发生。

另一类是关于VM虚拟机等方面的策略

内存泄露的Activity对象

内存泄露的SQLite对象

内存泄露的释放的对象

其中,内存泄露的Activity对象和内存泄露的SQLite对象都比较好理解,而所谓对关闭对象的检查,主要是去监那些本该释放的对象,比如应该调用close()方法的对象

相关的违反情况可以记录在LogCat中或者存储在DropBox中(android.os.DropBox)服务中

  如何使用:

  放在activity的周期onCreate方法中

 

XCode 无法显示Size Inspector

XCode 升级到4.5 以后,在View的设置界面中就再也找不到Size Inspector  的踪迹了,找了很长时间,才知道原来 到 4.5 的时候,引入了“Autolayout”功能来简化设计,可是,当需要手动配置某些复杂控件的时候,这个就不怎么智能了。

找到下面的方法禁止掉其自动的功能。只是所有的都要手动设置了。

在Interface Builder中选中View,然后在Attributes Builder中去掉“Use Autolayout”前面的钩,如下图:

1352635874_6561

Ubuntu 12 以及 13 清除Dash主页及电影播放器(视频)历史记录的方法

1.清除Dash主页中历史记录的方法。

系统设置-隐私-清除历史记录

也可在“应用程序”选项卡中,设置哪些应用软件不启用历史记录。

2.电影播放器用文本编辑器历史记录的清除方法。

ctrl+alt+t,打开命令行

Android 源代码 error: Exited sync due to fetch errors…

希望各位不要出现这个错误,出现这个错误就要折腾一会了

首先继续repo sync,若是一直提示这个错误,那么就按照下面的方法来做吧:

关于这个问题其实google是有说明的http://source.android.com/source/downloading.html,为了防止连接数过多,每个ip都需要认证。。。

第一步:从这里 the password generator 获取用户名和密码,前提是你在之前填写了你的真实姓名和邮箱

第二步:将上面的页面上以machine开头的两行复制到 ~/.netrc文件中

第三步:

多了个“/a”,并且指定 “--config-name”

参数,很多时候会用以前配置过的用户名密码,指定这个参数会重新设置用户名

然后就可以repo sync了

特别注意.netrc文件是在用户的根目录下,root用户就是/目录下,如果没有的话就自己建一个,把权限改为 777 好了

Install the Arduino IDE in Ubuntu 12.04

转自http://blog.markloiseau.com/2012/05/install-arduino-ubuntu/

Install the Arduino IDE in Ubuntu 12.04

Installing the Arduino IDE in Ubuntu only takes a few minutes. As usual, it’s a better idea to install the Arduino straight from the source, instead of relying on the version in Ubuntu’s repository. While it wasn’t hard to install the Arduino IDE, I noticed that the Arduino GUI was really slow and laggy. This is because the startup script tells Java to use Ubuntu’s GTK look and feel, which makes everything run slowly. It’s easily fixed by changing a single line in the startup script.

Update: In the Arduino 1.0.1 update, “Serial Port” is greyed out. The fix is outlined in the troubleshooting section.

Install the Arduino IDE in Ubuntuarduino_logo

  1. Install gcc-avr, avr-libc and openjdk-6-jre if you don’t have it already.
  2. Plug in the board, see where it’s connected
  3. Download and unpack the Arduino IDEtarball
  4. Run the IDE
  5. Select your board model and serial port
  6. Run a sample program
  7. Fix the buggy interface (optional)
  8. Troubleshooting

Everything worked out of the box, other than the interface.

Install gcc-avr and avr-libc

Gcc-avr and avr-libc give your system the tools it needs to compile c into AVR machine code:

If you don’t have openjdk-6-jre already, install and configure that too:

Once those are installed plug in your board and type  $ dmesg . It will print the kernel’s ring buffer and show you what USB port your Arduino is plugged into:

According to dmesg, our board is plugged into ttyACM0.

Download and Run the Arduino IDE

Go to the downloads page on Arduino’s download page to get the latest Arduino IDE tarball (.tgz file) for your architecture. My laptop is 64-bit, so I chose accordingly. Once the file was finished downloading, I unzipped and ran it with the following command:

Select your board model and serial port

I’m using an Arduino MEGA 2560, so I went to Tools>Board>”Arduino Mega 2560 or Mega ADK.” At this point, I noticed that the GUI was really slow and hard to use. If you want to fix it before proceeding, exit the IDE and skip to the  ”Fixing the Interface” section before proceeding.

The IDE flashed an error about how my board wasn’t accessible over the COM1 port. COM1 usually refers to a 9-pin serial port, and my laptop doesn’t even have one. I went to Tools>Serial Port and selected /dev/ttyACM0, which reflected the output I saw when I checked dmesg.

The errors went away, and I went to File>Examples>Basics>Blink and clicked upload. Sure enough, the LED started blinking. You should be ready to start writing and running Arduino programs!

Fix the Arduino IDE to make it run more smoothly in Ubuntu

Exit the Arduino IDE and go to the installation folder (the folder you unzipped from the .tgz file). Edit the “arduino” script in your favorite text editor. To make Arduino use the native Swing windowing instead of forcing the GTK look and feel, which is the cause of the bugginess, change the following line:

Just delete the -D flag and its argument. Personally, I get nostalgic about the old-school Swing look and feel, but either way, it fixed all of the lagginess issues I was experiencing.arduino_ide_ubuntu

My Arduino IDE, running in Ubuntu (using SWT instead of GTK)

Troubleshooting USB and the grayed out Serial Port

When I got the Arduino 1.0.1 update, “Serial Port” was grayed out in the tools menu. Running arduino as root ( sudo ./arduino) resolved the issue, but it’s not an acceptable solution. In my case, serial port was grayed out because my user didn’t have permission to read and write to the device.

I added my user to the dialout group with the command  sudo usermod -a -G dialout mark . Usually, that would have fixed it but iserial port was still grayed out.

Changing the permissions on /dev/ttyACM0 to world readable and writeable fixed the grayed out serial port. I ran  sudo chmod a+rw /dev/ttyACM0 and the serial port menu worked again.

I’ve noticed that running programs that send lots of data over USB can cause issues with the arduino programming software, making it give errors while uploading code. Holding down the reset button fixed my upload and USB errors in most cases.

Further Reading

If you read nothing else before you start writing programs, look at the official Arduino Reference page. It might be the most concise, complete language reference I’ve ever seen.

Ubuntu 13.04 Android Studio "Unrecognized VM option '+UseCodeCacheFlushing'"

下载完成最新的 Android Studio 结果执行 “./android-studio/bin/studio.sh” 的时候报告

“Unrecognized VM option '+UseCodeCacheFlushing'
Could not create the Java virtual machine.”

解决方法为 在 “/android-studio/bin” 目录下面找到 “studio.vmoptions”,如果你是 64未系统 就打开 “studio64.vmoptions”然后删除里面的 “-XX:+UseCodeCacheFlushing”

Ubuntu12.10 Broadcom (BCM4311)无线网卡驱动问题

DELL E5400 电脑安装 Ubuntu 12.10 ,但是不能识别无线网卡,在这个时候,查看默认的驱动,默认使用的驱动存在问题。

执行

命令,然后重启机器,保证最后的结果为下图所示就可以了。

2013-05-26 00:47:45的屏幕截图