Skip to content

Instantly share code, notes, and snippets.

View hjue's full-sized avatar

hjue hjue

  • Beijing, China
View GitHub Profile
@hjue
hjue / remove-google-redirect.user.js
Created September 13, 2014 01:07
UserScripts: 消除google结果跳转
// ==UserScript==
// @name 禁止google结果跳转
// @namespace http://blog.whosemind.net
// @description 去掉google搜索结果的跳转(http://www.google.com/url?), 而直接用原始链接
// @version 0.0.7
// @include /^https?:\/\/www\.google\.[^\/]+?\/(#.*|webhp.*|search\?.*)?$/
// ==/UserScript==
var eles,
timer,
s,
var flow = webdriver.promise.controlFlow();
var finish = function (done) {
driver.quit().then(function () {
done();
});
};
var error = function (e) {
driver.quit().then(function () {
@hjue
hjue / dropbox-justwriting-markdown.md
Last active August 29, 2015 14:12
使用Dropbox+Justwriting+Markdown搭建个人博客

使用Dropbox+Justwriting+Markdown搭建个人博客,让你真正体会到什么是“化繁为简”。你的所有的博文日志都存在你个人电脑里,即使有一天你的服务器主机挂掉了,你的数据也不会丢失。你完全不需要关注如何发布文章,你只需要在你的电脑里用Markdown书写。

这个方法搭建的博客还有一个优势,就是可以用作团队博客。具体操作是把Dropbox中的文章目录共享给你的团队成员,团队成员的Dropbox中就多了你分享的目录,他只需要在这个目录中添加Markdown文章即可。当然,他也可以修改你的文章,不过这个操作最好不要和你同时进行,否则文件会出现冲突。

安装JustWriting

JustWriting是支持Markdown的极简的开源博客系统,JustWriting不需要数据库支持,只需要把代码上传到web空间即可。点这里下载代码。

Justwriting的创意来自Farbox,在这里向FarBox及其团队致敬。

// Add the following to your preferences file
"folder_exclude_patterns":[".git","node_modules"]
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
// tries to execute the uri:scheme
function uriSchemeWithHyperlinkFallback(uri, href) {
// set up a timer and start it
var start = new Date().getTime(),
end,
elapsed;
// attempt to redirect to the uri:scheme
// the lovely thing about javascript is that it's single threadded.
// if this WORKS, it'll stutter for a split second, causing the timer to be off
@hjue
hjue / hd.txt
Last active August 29, 2015 14:22 — forked from EkkoG/hd.txt
http://devstreaming.apple.com/videos/wwdc/2015/2048w4vdjhe1i1m/204/204_hd_apple_watch_accessibility.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/213w6grumlfm0q/213/213_hd_building_apps_with_researchkit.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/209c9277tttlt9/209/209_hd_creating_complications_with_clockkit.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/2058z3fx76huw93/205/205_hd_getting_started_with_multitasking_on_ipad_in_ios_9.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/214dh5q5d0kswh/214/214_hd_introducing_on_demand_resources.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/5048tyhotl6/504/504_hd_introducing_safari_view_controller.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/211dseo3cn0bnw/211/211_hd_multitasking_essentials_for_mediabased_apps_on_ipad_in_ios_9.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/212mm5ra3oau66/212/212_hd_optimizing_your_app_for_multitasking_on_ipad_in_ios_9.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/
@hjue
hjue / nginx-block
Last active August 29, 2015 14:25
nginx block ipaddress
#!/bin/bash
nginx_home=/opt/nginx
log_path=$nginx_home/logs
tail -n50000 $log_path/access.log \
|awk '{print $1,$12}' \
|grep -i -v -E "google|yahoo|baidu|msnbot|FeedSky|sogou|127.0.0.1" \
|awk '{print $1}'|sort|uniq -c|sort -rn \
|awk '{if($1>1000)print "deny "$2";"}' >$nginx_home/conf/vhosts/blockip.conf
$nginx_home/sbin/nginx -s reload
@hjue
hjue / run-code.sh
Created July 23, 2015 07:37
run php code
#!/bin/bash
ulimit -f 64 -m 64 -t 2 -u 128
[[ ! -d /out/$1/ ]] && mkdir /out/$1/ || chmod u+w /out/$1/
for bin in /bin/php-*
do
echo $bin - $1
nice -n 15 sudo -u nobody $bin -c /etc/ -q "/in/$1" &>/out/$1/${bin##*-} & PID=$!
( sleep 3.1; kill -9 $PID 2>/dev/null ) &
@hjue
hjue / _elements.html
Last active August 29, 2015 14:25 — forked from Kevinlearynet/_elements.html
Static Site Engines with Node + Express Code Samples
# Elements
Fundamental building blocks of MIT Technology Review's digital styles.
## Doctype
{{ organization }} makes use of certain HTML elements and CSS properties that require the use of the HTML5 doctype. Include it at the beginning of all your projects.
### HTML
```html
<!DOCTYPE html>
<html lang="en">