yányào.com

looking a wood sprite in the forest

Recent posts

Oct 17, 2015
simple crawler半夜看了本小说觉得翻页太累 首先要解决的问题是找一个质量还过得去的小说站 然后写个脚本去把它爬下来章节合并到一起 import fs from "fs"; import { argv } from "process"; import request from "request"; import cheerio from "cheerio"; import iconv from "iconv-lite"; import sanitize from 'sanitize-html'; class main { constructor() { Object.assign(this, { path: './chapter.json', html: './reader.html', url: { list: 'http://www.piaotian.net/html/6/6658/' }, store: [] }) } fetch(url, callback) { request.get(url, {encoding: null}, (error, response, body)=> { if (!error && response.statusCode == 200) { let $ = cheerio.load(iconv.decode(body, 'GBK')); callback($, body); } else { console.…
Oct 11, 2015
send notification when task finish终端里运行长时间任务(比如 make systemimage)的时候经常会切换到其他环境做别的事情 容易忘记查看之前的任务是否完成, 查到一些方法用在任务结束时发出通知 #C-z 切到后台运行 fg; tput bel # Mac OS X #系统弹窗 osascript -e 'tell app "System Events" to display alert "Build Completed" message "The checkout and build have completed."' say "Job finished" #语音播报 #notification center osascript -e 'display notification "Job finished" with title "Alert"' sudo gem install terminal-notifier terminal-notifier -message "Job finished!" -title "Alert" # Ubuntu notify-send "Job finished!" # KDE kdialog --passivepopup 'Job finished' 还有 iterm2 trigger 也能用来触发通知, 高亮文字…
Oct 4, 2015
create CNAME with internationalized domain name前段时间买了个 idn: yányào.com 闲置了很长时间没动 趁着十一长假无所事事的机会, 把玩了一下 hexo 挂到 yanyaoer.github.io 然后 CNAME 的时候掉坑了, 看到有人说30分钟生效傻傻等就不提了 实际上这个域名的 CNAME 内容应该用编码后的字符串而不是 yányào.com https://github.com/yanyaoer/yanyaoer.github.io/commit/7c0e4e6863904442d368e3ad5c822f8f189bb7fc#diff-adc4bfdb0829dae99e3699393e3fbaa4 diff --git a/CNAME b/CNAME index 6cb647c..92d166c 100644 --- a/CNAME +++ b/CNAME @@ -1 +1 @@ -yányào.com +xn--ynyo-2nad.com …
Oct 4, 2015
xtag-and-shadowdom最近在做的项目重构, 原本打算用 reactjs, 写了一些实验代码后心累无爱 找了个 domdiff 配合自定义标签和 shadowdom 的独有作用域也是爽 YY 可惜的是测试红米上的 android webview 版本(32?)不支持 ::shadow 伪类 inline 方式覆盖样式略嫌繁琐 示例代码 xtag.js let dom = { shadow(el) { return el.createShadowRoot ? el.createShadowRoot() : el.webkitCreateShadowRoot(); }, attr(el, prefix='') { return Object.keys(el.dataset).map((d)=> `${prefix}${d}="${el.dataset[d]}"`).join(' ') } } document.registerElement('x-image', { prototype: Object.create(HTMLElement.prototype, { createdCallback: { value() { //xtag 嵌套时这里读不到attr, 放到 attach console.log('onCreate::image'); } }, attachedCallback: { value() { console.log('onAttach::image'); let shadow = dom.shadow(this); shadow.innerHTML = `<style> img { max-width: 100%; } </style> <img ${dom.…
Jan 20, 2015
remote pbcopy with netcatQuick start while (true); do nc -l 2224 | pbcopy; done #If your laptop is running linux, replacing pbcopy with xcopy should work: #while (true); do nc -l 2224 | xcopy; done echo "This text gets sent to clipboard" | nc localhost 2224 echo "RemoteForward 2224 localhost:2224" >> ~/.ssh/config ssh remote -t 'cat blablabla | nc -q0 localhost 2224' Daemonizing pbcopy launchctl load ~/Library/LaunchAgents/local.pbcopy.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.…
Oct 6, 2014
forward email by postfixsudo aptitude install postfix hostname -f # sudo vim /etc/postfix/main.cf myhostname = example.com myorigin = example.com mydestination = example1.com, example2.com, ... virtual_alias_maps = hash:/etc/postfix/virtual # sudo vim /etc/postfix/virtual @example1.com name@forward.com @example2.com name@forward.com sudo postmap /etc/postfix/virtual sudo /etc/init.d/postfix reload https://wiki.debian.org/Postfix#Forward_Emails https://www.linode.com/docs/email/postfix/basic-postfix-email-gateway-on-debian-6-squeeze https://www.debian-administration.org/article/243/Handling_mail_for_multiple_virtual_domains_with_postfix…
Aug 20, 2014
mitmproxymitmproxy 是个命令行下查看/修改 http 请求的交互式工具 #截图 #安装 sudo apt-get install python-dev libffi-dev pip install mitmproxy #使用 ubuntu 上启动 mitmproxy mitmproxy –host 手机 设置 -> WLAN -> 代理 主机名: ubuntu 的 ip 端口: 8080 然后访问网络就会在 mitmproxy 里看到请求记录(如截图) #快捷键 j,k 上下移动 enter 进入 tab 切换 request/response #参考 http://mitmproxy.org/doc/mitmproxy.html http://blog.philippheckel.com/2013/07/01/how-to-use-mitmproxy-to-read-and-modify-https-traffic-of-your-phone/…
Aug 28, 2013
brick intro#Introducing Brick: Minimal-markup Web Components for Faster App Development #介绍 brick: 用于快速开发 webapp 的自定义标签组件 https://hacks.mozilla.org/2013/08/introducing-brick-minimal-markup-web-components-for-faster-app-development/ Those of you on the cutting HTML5 edge may have already heard of the exciting Web Components specification. If you haven’t, you’ll probably want to read up on what makes this so exciting, but long story short, Web Components promise to open up a new realm of development by letting web developers write custom, reusable HTML tags.…
Jun 9, 2013
my osx setup#setting # Enable full keyboard access for all controls defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 # Disable menu bar transparency defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false # Allow quitting Finder via ⌘ + Q; doing so will also hide desktop icons defaults write com.apple.finder QuitMenuItem -bool true # Avoid creating .DS_Store files on network volumes defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true # Disable the warning when changing a file extension defaults write com.…