| Project | Client | Progress |
|---|---|---|
| 行业调研 | hejus | |
| 蚁言改造项目 | hejus |
最新发布 RSS Toggle Comment Threads | 键盘快捷键
-
hejus
-
hejus
今天上午发现ip解禁,联通又出现了段时间的DNS污染,下午全部正常。(似乎与我关闭resale内别人申请的两个有争议内容的VPS有关)。
蚁言改造项目
1. p2主题修改(/ajax.php):12345678910111213141516171819202122232425262728293031323334function save_post() {check_ajax_referer( 'ajaxnonce', '_inline_edit' );if ( !is_user_logged_in() ) {die( '<p>'.__( 'Error: not logged in.', 'p2' ).'</p>' );}$post_id = $_POST['post_ID'];$post_id = substr( $post_id, strpos( $post_id, '-' ) + 1 );if ( !current_user_can( 'edit_post', $post_id )) {die( '<p>'.__( 'Error: not allowed to edit post.', 'p2' ).'</p>' );}//根据post_id判断post_title的值,然后传回去// Don't treat the post differently based on user's visual editor setting.// If the user has disabled the visual editor, the post_content goes through an "extra" esc_textarea().add_filter( 'user_can_richedit', '__return_true' );$post = get_post( $post_id, OBJECT, 'edit' );$post_format = p2_get_post_format( $post_id );$new_post_content = $_POST['content'];// Add the quote citation to the content if it existsif ( ! empty( $_POST['citation'] ) && 'quote' == $post_format ) {$new_post_content = '<p>' . $new_post_content . '</p><cite>' . $_POST['citation'] . '</cite>';}$new_tags = $_POST['tags'];//$new_post_title = isset( $_POST['title'] ) ? $_POST['title'] : '';$new_post_title = isset( $_POST['title'] ) ? $_POST['title'] : $post->post_title;...2. 去除关键词记录区域,直接以日志记录代替;
3. 配置服务器时间。基本限定了硕士课题的视觉部分(镜头、相机或智能相机)的部件候选范围
-
hejus
今天蚁言改造工程基本完工了,按照计划,应该记一下今天的日志,但是时间有限,简短短一点吧。
关于项目:
1. 添加了两个插件:Crayon Syntax Highlighter和Project Status,两者之间有冲突。前者会在后者的编辑页面的几个Description字段处载入自定义的编辑器,从而会将对应的区域内的数据抹掉(表现为一旦提交数据后刷新页面,对应字段原来填好的数据会随着编辑器的载入消失),这样一旦wordpress自动保存,数据就都消失了。解决的方法就是将这些字段的自定义编辑器去掉。做了个简单的改动,下次更新的时候,如果没有修正这个bug,还用这种方法即可:123<!--span class="customEditor"><textarea name="fourty_percent_desc" cols="75" rows="10" class="mce"><?php echo $fourty_percent_desc; ?></textarea></span></p--><!--将class="customEditor"去掉,变为如下,共有两处Current和四处Description--><span><textarea name="fourty_percent_desc" cols="75" rows="10" class="mce"><?php echo $fourty_percent_desc; ?></textarea></span></p>2. 校园网不知为什么把VPS的IP给禁了,看看今后会不会解禁吧
-
hejus
burstnet控制面板SolusVm的api
最近把站点签到了burstnet的Xen主机上,顺便也给其他的一些人代购了Xen的VPS,发现burstnet很傻很天真地,将所有的用户全都绑定在了一个控制面板下。发信去问,得到的答复是Xen的Win和Linux主机现在都不支持单账号的控制面板,作为reseller只能亲自操作控制面板了。
后来我注意到控制面板中可以获得每个VPS的api key和api hash,通过这个可以对VPS进行简单的操作,应该能满足客户的需求了。于是开始着手做,没想到,burstnet的使用跟SolusVm的官方说明还有点不同,发信去问,回答的模棱两可,大意就是说这不在我们工作范围内(那你倒是把文档写好啊)。于是找到burstnet的官方论坛,发现了一点蛛丝马迹,但是注册之后还没权限浏览。
最后实在没办法,照着网上搜到的一名网友通过手机管理自己VPS的代码开始改,初步可以用了,但是只有简单的几项操作,总觉得有一点不够,最终让我搜到了一篇很详细的介绍,转载过来:
Burst.NET Windows VPS && SolusVM API
…
So I found SolusVM Client API wiki page and tried it out. Turns out that the sample doesn’t work. It uses POST. GET method worked out. I edited the script and quickly made this to show a nice status output:12345678910Virtual Machine: burst.scottn.usMain interface: 184.22.59.33IPs: 184.22.59.33184.22.59.342607:f878:4:1d::c20:5f792607:f878:4:1d::3df:4a2dHarddisk Usage: 0 B of 20 GB (0%)Memory Usage: 0 B of 0 B (0%)Bandwidth Usage: 835.96 MB of 1000 GB (0%)Status: ONLINE(其实主要就是上面的信息拿不到)
Read full story to see source below:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263#!/usr/bin/php-cgi -q<?php// Specify the key, hash and action$postfields["key"] = "xxxxx-xxxxx-xxxxx";$postfields["hash"] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";$postfields["action"] = "status"; // reboot, shutdown, boot, status$postfields["ipaddr"] = "true";$postfields["hdd"] = "true";$postfields["mem"] = "true";$postfields["bw"] = "true";// Url to the client API$url = "https://184.22.97.170:5656/api/client/command.php";// Send the query to the solusvm master$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url . "?" . http_build_query($postfields));curl_setopt($ch, CURLOPT_TIMEOUT, 20);curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);$data = curl_exec($ch);curl_close($ch);// Parse the returned data and build an arraypreg_match_all('/<(.*?)>([^<]+)<\/\\1>/i', $data, $match);$result = array();foreach ($match[1] as $x => $y){$result[$y] = $match[2][$x];}// TODO: Error checking ...// Do something useful with it.$hdd = explode(",", $result["hdd"]);$mem = explode(",", $result["mem"]);$bw = explode(",", $result["bw"]);printf("Virtual Machine: %s\n", $result["hostname"]);printf("Main interface: %s\n", $result["ipaddress"]);printf("IPs: %s\n\n", str_replace(",", "\n", $result["ipaddr"]));printf("Harddisk Usage: %s of %s (%d%%)\n", formatSize($hdd[1]), formatSize($hdd[0]), $hdd[3]);printf("Memory Usage: %s of %s (%d%%)\n", formatSize($mem[1]), formatSize($mem[0]), $mem[3]);printf("Bandwidth Usage: %s of %s (%d%%)\n\n", formatSize($bw[1]), formatSize($bw[0]), $bw[3]);printf("Status: %s\n", strtoupper($result["statusmsg"]));function formatSize($size){$units = array(' B', ' KB', ' MB', ' GB', ' TB');for ($i = 0; $size > 1024; $i++) { $size /= 1024; }return round($size, 2).$units[$i];}?> -
hejus
ubuntu更新时no_pubkey问题
参考缺少公钥问题的解决方法
症状:12sudo apt-get updateW: GPG error: http://apt.tt-solutions.com dapper Release: 由于没有公钥,下列签名无法进行验证: NO_PUBKEY 06EA41DE4F6C1E86解决方法:
123gpg --keyserver subkeys.pgp.net --recv 4F6C1E86gpg --export --armor 4F6C1E86 | sudo apt-key add -(说明:若缺少其他公钥,则将命令中两处4F6C1E86改为“NO_PUBKEY 06EA41DE4F6C1E86”中最后8位即可!)如果是Ubuntu PPA的
1sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com另外,当出现“下列签名无效的错误”时,可以用如下方法解决:
1234cd /var/lib/aptsudo mv lists lists.oldsudo mkdir -p lists/partialsudo apt-get update -
hejus
apache2添加virtualhost
1. 解注释“#NameVirtualHost *:80”,如果多个IP对应不同virtualhost,那么将*替换为IP,IPv6地址需要用[ipv6 addr]形式;
2. 在合适的地方添加:
1234567<VirtualHost *:80>ServerAdmin webmaster@dummy-host.example.comDocumentRoot /www/docs/dummy-host.example.comServerName dummy-host.example.comErrorLog logs/dummy-host.example.com-error_logCustomLog logs/dummy-host.example.com-access_log common</VirtualHost>多个IP和IPv6形式同前面一致;
3. 此方法用来添加二级域名,修改后,重启服务,然后将域名指向服务器所在ip即可;4. 添加文件夹属性设置。
centos+httpd环境下,需要修改httpd.conf或在最后添加:“Include /etc/httpd/conf/*.conf”,而在ubuntu或debian环境下,需要分别修改000-default和ports.conf。