Submitted by gouki on 2015, October 9, 5:47 PM
这是一个备份,起因是由于我现在使用的gogs不能使用ssh的方式连接,主要是不方便,所以目前我是使用了HTTP的方式。
看了这篇文章后对我有启发,但是我没有使用,所以只是先做个备份。原文在:http://www.luxingmin.com/archives/278.html
XML/HTML代码
- 一直想实现指定git访问的私钥,网上资料给出来的都是通过ssh_config来实现,这种方法很繁琐,另外想实现git webhook部署时,使用这种方法也比较不灵活。
-
- 切入正题
-
- 建立git_ssh文件,内容如下
-
- #!/bin/bash
- ssh -i $SSH_KEY_FILE $1 $2
- 然后增加执行权限
-
- chmod 755 git_ssh
- 然后就可以通过如下命令指定git访问时使用的ssh私钥
-
- SSH_KEY_FILE=/root/git/id_rsa GIT_SSH=/root/git/git_ssh git clone git@xxx
---EOF---
Tags: ssh, git, gogs
Linux | 评论:0
| 阅读:21556
Submitted by gouki on 2015, October 8, 5:10 PM
转一篇Vargrant的相关文章【Vagrant下共享目录静态文件(js/jpg/png等)“缓存”问题】,原文来自:http://blog.smdcn.net/article/1325.html,主要是问题在于使用了sendfile可能会导致部会内容不会刷新。
原文如下:
XML/HTML代码
- 之前提到说通过Vagrant部署开发环境,使用目录共享模式,在本地磁盘进行开发,而通过虚拟机环境运行开发的页面。
-
- 是的,一切看起来都是那么的顺利,首先基于VirtualBox安装了Vagrant,接下来,按照以往部署环境的习惯,在VM中安装了nginx作为开发运行环境,并且将本地的共享目录作为nginx的web目录,然后打开页面,看上去似乎都很正常,但接下来,你发现了一个神奇的事情,你修改替换了一个css,一张图片,然后刷新浏览器,发现什么都没有变,然后你有非常猛烈、使劲的F5,依旧还是没有改变,是的,你看看编辑器,似乎替换是正常的,在看看VM上的文件,也都是对的,是的,尝试重启nginx,依旧没有任何变化,你开始怀疑php5-fpm甚至于毫不相干的memcached和mysql,但都无济于事。也不知道是什么让这些文件被“缓存”了呢。
-
- 当你尝试修改一个js,并且用同样的方法更新之后,会遇到类似的问题,是的,就算重启VM上任何服务,甚至重启VM,依旧没有用,当然,比起其他资源文件,浏览器的反应会强烈一些,因为浏览器会提示未知错误,而你通过浏览器查看你修改的JS文件,会看到文件尾巴有下面奇怪的随机字符:
-
- �����������������
-
- 这到底是什么东西呢?编码错误?缓存异常?又或是其他什么?
-
- 是的,你尝试花费很多时间,试验各种各样的方法去解决这个问题,其实对于nginx来说,你只需要修改配置文件(nginx.conf)中的一行重启就能简单的解决这个问题:
-
- sendfile off;
- 找到 nginx.conf ,把里面的 “sendfile on” 修改为 “sendfile off”。
-
- 当然,如果你使用Apache也可能遇到类似的问题,那么同样也有类似的配置需要修改:
-
- EnableSendfile off
- 关于这个问题的参照:
- https://github.com/mitchellh/vagrant/issues/351#issuecomment-1339640
-
- http://stackoverflow.com/questions/9479117/vagrant-virtualbox-apache2-strange-cache-behaviour
----转载完毕---
关于这个sendfile,还有人做了个测试:记vagrant nginx sendfile问题,然后居然没有人评论。。。
XML/HTML代码
- 从今年开始,一直在vagrant虚拟机上做开发
-
- 因前段时间一个项目需要调试静态文件,出现静态文件修改后,浏览器刷新不生效。
-
- 最后追踪到是nginx开启了sendfile这一项。。
-
- 具体sendfile原理可以查下,,网上写的都很详细,这里就不复述了。
-
- 一开始一直认为是nginx某个地方配置有问题。。但后来干脆自己写下,做下测试
-
- 具体代码如下(tcp那几步连接这里就不写了。网上很多):
-
-
- /**
- * @connect tcp 连接句柄
- */
- int sendClient(int connect)
- {
- int fd;
- struct stat fileStat;
- off_t offset = 0;
- fd = open("/data/web/test.com/index.html", O_RDONLY|O_NONBLOCK);
- if (fd < 0) {
- perror("open file.");
- return 0;
- }
- //获取文件信息
- fstat(fd, &fileStat);
- char buffer[fileStat.st_size];
- // read(fd, buffer, fileStat.st_size);
- //write(connect, buffer, fileStat.st_size);
- sendfile(connect, fd, &offset, fileStat.st_size);
- close(fd);
- return 1;
- }
-
- 至些我测了下,得到的还是不生效,由此可以断定,与nginx无关,与系统调度有关
-
- 至于问题,我现在的回答只能是vagrant的一个坑,具体是什么,我也无从得知,
-
- 当然, 这个我也是从表象猜测, 如果有人知道真正的原因, 还请不吝留言指教
Tags: vagrant
Linux | 评论:0
| 阅读:17157
Submitted by gouki on 2015, September 26, 1:37 PM
Linux | 评论:0
| 阅读:18154
Submitted by gouki on 2015, August 31, 10:55 AM
最近收到一封邮件,大意是,phpanywhere已经改名为codeanywhere了,我看了一下邮件中提及的博客日期,发现贴子地址是:http://www.neatstudio.com/show-1305-1.shtml ,已经是N年前的事情了。
邮件中提及:As you may have heard we have changed our name to Codeanywhere a couple of years back and now we have an issue. Namely we lost the domain phpanywhere.net and know all your link lead to nowhere.
为了以防万一,我查了一下百科:
https://en.wikipedia.org/wiki/Codeanywhere
- History[edit]
- In 2009 PHPanywhere (the predecessor of Codeanywhere) was launched, which was a web-based FTP client and text editor, designed for PHP.[4] That project stayed idle until May 22, 2013 when the founders launched Codeanywhere.
-
- Codeanywhere raised $600,000 from World Wide Web Hosting on July 15, 2013 when Ben Welch-Bolen became a board member.[5] In August of 2014 Codeanywhere was accepted in Techstars’s Fall Boston Class.[6] In 2014, as part of the TechCrunch Disrupt NY Conference, the audience voted Codeanywhere the best company in Startup Alley.[1]
so,phpanywhere确实是codeanywhere的前身。。。于是顺手改掉了那篇博客,顺便说一下,codeanywhere很早就在ipad上面有APP了,而且我还用过,只是居然真的不知道它就是phpanywhere....
Linux | 评论:2
| 阅读:19238
Submitted by gouki on 2015, August 10, 2:29 PM
这是一篇backup的文章。起因是我的命令行下的gdb出现了:
XML/HTML代码
- Starting program: /usr/local/Cellar/php56/5.6.9/bin/php /server/yii hprose
- Unable to find Mach task port for process-id 30717: (os/kern) failure (0x5).
- (please check gdb is codesigned - see taskgated(8))
于是google了一下,发现也有人在问类似的问题:
XML/HTML代码
- Because I need a Python-enabled gdb, I installed another version via
-
- brew tap homebrew/dupes
- brew install gdb
- I want to use this gdb with Eclipse CDT, where I entered the path to the binary in the Debugging settings. However, launching a program for debugging fails with the following message:
-
- Error in final launch sequence
- Failed to execute MI command:
- -exec-run
- Error message from debugger back end:
- Unable to find Mach task port for process-id 39847: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))
- Unable to find Mach task port for process-id 39847: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))
- What does "codesigned" mean in this context? How can I get this gdbrunning?
有一个5个点赞的,我发现无效:
XML/HTML代码
- t would seem you need to sign the executable. See these links for more information. You should be able to get away with self signing if you don't plan on redistributing that version of gdb.
-
- https://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html
-
- https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/codesign.1.html
-
- Alternatively, you could disable code signing on your system, although this presents a security risk. To do so try running sudo spctl --master-disable in the Terminal.
24人点赞的看上去不错:
XML/HTML代码
- I.1 Codesigning the Debugger
-
- The Darwin Kernel requires the debugger to have special permissions before it is allowed to control other processes. These permissions are granted by codesigning the GDB executable. Without these permissions, the debugger will report error messages such as:
-
- Starting program: /x/y/foo
- Unable to find Mach task port for process-id 28885: (os/kern) failure (0x5).
- (please check gdb is codesigned - see taskgated(8))
- Codesigning requires a certificate. The following procedure explains how to create one:
-
- Start the Keychain Access application (in /Applications/Utilities/Keychain Access.app)
- Select the Keychain Access -> Certificate Assistant -> Create a Certificate... menu
- Then:
- Choose a name for the new certificate (this procedure will use "gdb-cert" as an example)
- Set "Identity Type" to "Self Signed Root"
- Set "Certificate Type" to "Code Signing"
- Activate the "Let me override defaults" option
- Click several times on "Continue" until the "Specify a Location For The Certificate" screen appears, then set "Keychain" to "System"
- Click on "Continue" until the certificate is created
- Finally, in the view, double-click on the new certificate, and set "When using this certificate" to "Always Trust"
- Exit the Keychain Access application and restart the computer (this is unfortunately required)
- Once a certificate has been created, the debugger can be codesigned as follow. In a Terminal, run the following command...
-
- codesign -f -s "gdb-cert" <gnat_install_prefix>/bin/gdb
- ... where "gdb-cert" should be replaced by the actual certificate name chosen above, and should be replaced by the location where you installed GNAT.
- source: https://gcc.gnu.org/onlinedocs/gcc-4.8.1/gnat_ugn_unw/Codesigning-the-Debugger.html
这个4人点赞的简洁明了:
XML/HTML代码
- I made gdb work on OSX 10.9 without codesigning this way (described here):
-
- Install gdb with macports. (may be you can skip it)
-
- sudo nano /System/Library/LaunchDaemons/com.apple.taskgated.plist
- change option string from -s to -sp at line 22, col 27.
-
- reboot the computer.
-
- Use gdb
然而这都没有什么卵用,这时候一个2人点赞的说了一个重点:
XML/HTML代码
- It's a very old topic, but I am adding a response, because out of many available instructions, only one contained just the right steps to make a self-signed debugger work.
-
- You have to create a self-signed root certificate and then sign the gdb executable with it, but many people complained that it did not work for them. Neither did it for me until I stumbled upon this link.
-
- The key point missing in other manuals is that you have to restart your computer for the changes to take effect. Once I did that, everything worked as intended.
-
- I hope, this will help others.
是的,他在have to restart上加粗了!!!
最后一个回复表示使用了4人点赞的那个建议,并表示他就是这么完成的!原文来自:http://stackoverflow.com/questions/13913818/how-to-get-a-codesigned-gdb-on-osx
Linux | 评论:0
| 阅读:19816