Skip to content

Instantly share code, notes, and snippets.

Avatar
Focusing

liuyanghejerry liuyanghejerry

Focusing
View GitHub Profile
@liuyanghejerry
liuyanghejerry / index.html
Last active May 27, 2019
Modern index file in 2017
View index.html
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#">
<head>
<!-- content-type, which overrides http equivalent header. Because of charset, this meta should be set at first. -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- Overrides http equivalent header. This tells IE to use the most updated engine. -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<!-- Tells crawlers how to crawl this page, and the role of this page. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta -->
<meta name="robots" content="index, follow">
@liuyanghejerry
liuyanghejerry / gist:a309ef54580004879b40
Created May 7, 2014
在小米路由上运行Node.js
View gist:a309ef54580004879b40

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

背景知识

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

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

热身准备

@liuyanghejerry
liuyanghejerry / index.html
Last active Jan 21, 2016 — forked from anonymous/index.html
Short sample to illustrate :lang() // source https://jsbin.com/yowaro
View index.html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.target:lang(zh) {
color: green;
}
@liuyanghejerry
liuyanghejerry / 0_reuse_code.js
Created Dec 28, 2013
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@liuyanghejerry
liuyanghejerry / is_in_dict.cpp
Last active Dec 25, 2015
给定字符串,以及一个字典,判断字符串是否能够拆分为字段中的单词。例如,字段为{hello,world},字符串为hellohelloworld,则可以拆分为hello,hello,world,都是字典中的单词。 题目来源:http://mp.weixin.qq.com/mp/appmsg/show?__biz=MjM5ODIzNDQ3Mw==&appmsgid=10000306&itemidx=1&sign=45327171923a822ffd8727e6983727c2 原题解是动态规划,本代码是备忘录式的递归法。
View is_in_dict.cpp
#include <iostream>
#include <string>
#include <unordered_map> // need c++11 or c++0x
using namespace std;
unordered_map<string, bool> dict;
unordered_map<string, bool> memo;
inline bool is_in_dict_pri(const string& word)
@liuyanghejerry
liuyanghejerry / main.cpp
Created Oct 12, 2013
Calculate how many different IP in painttyServer's log.
View main.cpp
#include <QCoreApplication>
#include <QFile>
#include <QFileInfo>
#include <QTextStream>
#include <QStringList>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
@liuyanghejerry
liuyanghejerry / PainterTest.pro
Created Aug 11, 2013
This is a test case of tablet support for Qt 5.
View PainterTest.pro
QT += core gui concurrent
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = PainterTest
TEMPLATE = app
CONFIG += c++11
SOURCES += main.cpp\
@liuyanghejerry
liuyanghejerry / redis.sh
Last active Dec 16, 2015
Redis-server management script for CentOS 6.3.
View redis.sh
#!/bin/bash
# chkconfig: - 80 12
# description: Controller for redis-server
# processname: redis
# useage: redis {start|stop|restart}
# notice, you need to edit these 4 variables bellow to suit your condition
BIN="/usr/local/redis/bin/redis-server"
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-0.14.3.js"></script>
<script src="http://fb.me/react-dom-0.14.3.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.rating-table {
border: 0;
@liuyanghejerry
liuyanghejerry / install-py27.sh
Created Dec 4, 2015
Safely install Python 2.7 on CentOS 6.5+
View install-py27.sh
yum install centos-release-SCL
yum install python27 python27-scldevel
# then add those line to your .bash_rc or .bash_profile
# note that space between dot and slash
# . /opt/rh/python27/enable
# Or if you want a better solution: http://developerblog.redhat.com/2014/03/19/permanently-enable-a-software-collection/
You can’t perform that action at this time.