Skip to content

Instantly share code, notes, and snippets.

View hedongjie's full-sized avatar

小本堂 hedongjie

View GitHub Profile
#!/bin/bash
base_path=$(cd `dirname $0`;pwd)
daemon_pid=$base_path/daemon.pid
if [ -e $daemon_pid ]; then
pid=`cat $daemon_pid`
exist=`ps aux | grep $pid | grep -v grep`
if [ ${#exist} -gt 0 ]; then
exit 0
else
echo -n '' > $daemon_pid

相信很多人和我一样,拿到小米路由玩了几天,感觉官方的步伐不够快不够激进。既然如此,何不自己动手丰衣足食呢?

背景知识

首先你得知道Linux的一些基本理论,比如什么是bash啊,cdls这些命令怎么用等等。

其次你还得知道一些编程相关的东西,因为文章专注于Node.js的编译,所以Node.js和C++的一些基本知识是要有的。

热身准备

function randomColor(){
return "rgb("+Math.floor(Math.random()*255)+","+Math.floor(Math.random()*255)+","+Math.floor(Math.random()*255)+")";
}
function showBoxes(window) {
var rects = [];
function getRects(node){
var range = window.document.createRange();
range.setStartBefore(node);
range.setEndAfter(node);
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@hedongjie
hedongjie / dabblet.css
Created February 15, 2012 08:24
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
span,div{width:100px;height:100px;background:red; display:inline-block;}