需求如题,拼拼凑凑得到这个代码
<?php
ob_start();
echo "hello world";
setcookie("username", "123");
$output = ob_get_clean();
echo $output;
file_put_contents("log.txt", date("Y-m-d H:i:s") . "\n" . print_r(getallheaders(), …… 阅读全文
Author Archives: ZRJ
Chrome 扩展的文件提取
在 google chrome store 上有一个很不错的扩展,叫做 dream afar,他会修改 chrome 的新标签页,替换成很漂亮的背景图,而且还会定时更新,图片确实很不错,于是我就想找到图片源,一开始以为,页面上的图片嘛,总是应该从网络上下载的,于是开 google chrome 的开发者工具,抓了半天没抓到,都提示 from cache,那我就开…… 阅读全文
屏幕保护程序中等待选项灰色
由于未知原因,我的机器不能自动锁屏了。原本,自动锁屏是通过屏幕保护程序配合激活时需要密码来进行的,但是现在屏幕保护的时间没的选了,灰色,固定为 60 分钟。
看到这里,http://ibm.chick.blog.163.com/…
第1步:在注册表编辑器中展开HKEY-CURRENT-USER\Software\Policies\Microsoft\Windows\ControlPanel\De…… 阅读全文
vim 多行替换
全局的 vim 字符串替换很常用,但是指定某几行的就生疏一些,其实是可以这么用的
:125,138s/^/#/g
上面的这里有个坑,那个指定行数的地方是逗号,不是连接符,这种一般不是表示 125 和 138 两行的嘛
阅读全文
Single Number II
https://oj.leetcode.com/proble…,承前,http://zrj.me/archives/1344,这个题目是每个数字出现三次,要求找出只出现一次的数字:
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could …… 阅读全文
Linux bash explode string
想要对一个很长的行根据分隔符断开,搜了一下,这次万能的 stackoverflow 居然没有合适的答案,于是只能自己搞,想了想,其实很简单,这么写就可以了
head part-00079 -n 1 | sed "s/\t/\r\n/g"
其实就是 sed,这个思路可以自由发挥的空间很大,想实现什么效果都简单
阅读全文
Single Number
来看这个题,https://oj.leetcode.com/proble…:
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
第一反应就是异或,唯一需要确认的就是异…… 阅读全文
Linked List Cycle
所谓拳不离手曲不离口,算法和基础不能丢。
话说三藏师徒四人辞别女儿国,再上西行路,今天来到。。。啊呸,扯远了。。
今天来看这个,https://oj.leetcode.com/proble…,题目是这么说的
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
这题原…… 阅读全文
Linux 交换分区耗尽
今天在跑自己的业务进程的时候发现很卡,看了一下这个 free 命令的输出
$ free -m
total used free shared buffers cached
Mem: 7972 727 7244 0 0 420
-/+ buffers/cache: 306 7666
Swap: 1913 …… 阅读全文
目前的 rss 订阅源
<outline type="rss" title="DogEye www.DogEye.Net" text="DogEye www.DogEye.Net" htmlUrl="http://www.dogeye.net" xmlUrl="http://www.dogeye.net/feed/"/>
<outline type="rss" title="Beyond the Void" text=&quo…… 阅读全文