手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表2024年09月的文章

mac上怎么安装gcc?

本来想在本机安装sshpass,但突然发现。。。./configure不能运行,提示我没有安装gcc等工具。

一想,好象以前安装xcode的时候,会有gcc安装的呀。但我辛苦安装了xcode之后,仍然提示没有gcc。

纠结,怎么办?找了点资料,果然官方就有:

1、登录:developer.apple.com,注册一个帐号,嗯,免费的,只是耗点时间而已

2、进入http://developer.apple.com/download,搜索一下:command line,下载回来安装即可:100多M

这时候就OK了啦。不过,也有缺点,command line tools for xcode里自带的svn只是1.6,现在好多都是1.7的了。还得升级。

升级,还是用brew install会方便一点。不过我只是说安装gcc,就下载一个command line tools for xcode即可了

Tags: mac, gcc, xcode

dnspod ddns.php

其实dnspod官方有phpsdk,只是自己写的看起来好看一点。原来我用的是shell版的,但shell版的时候nc ns1.dnspod.net出来的IP老是不正确。估计是整个大楼里面有代理 。
但是我访问 http://iframe.ip138.com/ic.asp,里面出来的IP是真实IP,所以没办法,我只能改成PHP了(主要是因为不知道wget 或者 curl回来的文件怎么grep得到那个IP,好吧,我OUT了)
所以,花了5分钟写了个脚本。。。执行,没有报 任何错,好吧,原来是我没有输出。
输出的时候发现,不支持get方式提交。于是我偷了个懒,直接把file_get_contents用POST方式提交了。
OK,更新成功。但我发现,如果用Record.Ddns接口,那么,还是用的类似ns1.dnspod.net的探测方式,所以IP不准,最后,只能用Record.Modify接口来更新域名了。。

不多说废话,代码地址:https://github.com/neatstudio/yiiextension

用法也相当简单:

XML/HTML代码
  1. @description  
  2.     其实这个程序是扔在命令行下的,最好是crontab。  
  3.     因为远程获取IP地址比较耗时间  
  4. @useage  
  5.     在使用前最好chmod +x Dnspod.php  
  6.     注意第一行#!/usr/bin/env php,当然你也可以去掉这一条,直接使用/xxx/xxx/php Dnspod.php  
  7.     crontab -e 后加入一条:  
  8.     */10 * * * * /xxx/xxx/Dnspod.php  

tree

看到标题不要以为是植树节,tree这个命令还是很爽的。
在windows下面,我们用tree命令可以将当前的目录结构打印出来方便工作交接和介绍项目,在linux下面。。。。默认没有这个tree命令。
因为我用ubuntu,所以直接apt-get install tree,就OK了。

用法很简单,如果你不愿意记参数,直接去要统计的目录下面执行一下,tree
然后就出来结构树了。最后还有一行:
952 directories, 4642 files

好吧,这是我的一个项目中的protected目录,嗯。主要是因为多了一个zend框架,如果没有它。我只有1000多个文件了。整个项目还不如一个框架。。。。

如果apt也回不来?这里有一篇文章可以参考一下:http://www.cnblogs.com/dekun_1986/archive/2011/09/04/2166146.html

我用busybox建的根文件系统,没有这个tree命令,可以下载此命令的源码,交叉编译一下,再放到根文件系统中的/bin目录中就好。

源码下载地址:ftp://mama.indstate.edu/linux/tree/

我是在arm平台下,所以把makefile 文件中的CC那行改为“CC=arm-linux-gcc”,再把生成的tree文件通过nfs弄到开发板的bin文件下就可以了

现在的最新版本是1.6.0,下载地址: 

 /Files/dekun_1986/tree-1.6.0.rar

---EOF---

上述的链接是在cnblogs的。如果你不放心,就去上面的ftp地址下载吧。

Tags: tree

proftpd 问答

Frequently Asked Questions
Question: Why do I see the following when my proftpd starts up?

  getaddrinfo 'hostname' error: No address associated with hostname   warning: unable to determine IP address of 'hostname' 

Answer: This error is ProFTPD's way of reporting that it was unsuccessful in resolving hostname to an IP address. Fixing this is a matter of configuring DNS for that hostname: properly set up an IP address for that DNS name in your DNS server, use a DNS name that has an IP address, or (as a quick fix/last resort) add that DNS name to your /etc/hosts file. The proper solution depends largely on the circumstances.

Question: If proftpd resolves any DNS names to IP addresses when it starts up, and I am using dynamic IP addresses which change after my proftpd has started, will proftpd see my new IP addresses?
Question: Unfortunately not. ProFTPD has no easy way of handling dynamic IP addresses by itself. One way of dealing with this situation is to restart proftpd periodically, which will force it to re-parse its configuration and thus re-resolve all IP addresses.

Question: What if I do not want proftpd to use DNS to resolve the hostname to an IP address because I am in an environment where there is no DNS at all?
Answer: In ProFTPD 1.3.3rc1, support for a new -S command-line option was added. This option can be used to specify the IP address of the host machine. By default, proftpd attempts to resolve the host IP address by using DNS resolution of the hostname. However, in cases where DNS is not configured for the host machine, this approach does not work.

To specify the desired IP address, use -S when starting proftpd, e.g.:

  /usr/local/sbin/proftpd -S 1.2.3.4 ... 

And if you want proftpd to listen on all interfaces, you can specify a wildcard socket using an IP address of 0.0.0.0:

/usr/local/sbin/proftpd -S 0.0.0.0 ...

Note that will also mean that, in your proftpd.conf, any <VirtualHost> sections will need to use IP addresses, not DNS names.

Tags: proftpd

PHP 飞信类

偷了个懒,代码扔在github上了。
用法也很简单:

    $fetion = new PHPFetion('用户名','密码');     $fetion->send('对方手机','信息');     会自动识别自己还是对方。(非好友不能发哦)

也实现了$fetion->multiSend,但我偷了个懒,直接循环用send发送了。
事实上,可以在刚登录的时候,利用group先将好友列表拉回来,然后就方便了。但觉得这样就复杂了。何必呢。。一般在用飞信的时候,也很少会用到群发功能吧。所以,我还是循环的send。黑黑

代码地址:https://github.com/neatstudio/yiiextension
欢迎围观

Tags: 飞信, fetion