Skip to content

Instantly share code, notes, and snippets.

View Hyvi's full-sized avatar
🎯
Focusing

Hyvi Hyvi

🎯
Focusing
  • huawei Inc
  • china
View GitHub Profile
@Hyvi
Hyvi / test
Created February 27, 2011 12:19
test for gwf
spawn openvpn --config /etc/openvpn/Global.ovpn
#expect "[sudo] password for hyvi: "
#send "密码\n"
#sleep 2
expect "Enter Auth Username:"
send "邮箱\r"
sleep 2
expect "Enter Auth Password:"
send "密码\r"
expect eof
@Hyvi
Hyvi / 服务器测试
Created March 16, 2011 00:44
服务器,在学校机房测试
http://tool.chinaz.com/ 站长工具
http://www.linkwan.com/gb/ 网络测试(基于google地图)
@Hyvi
Hyvi / QQ云输入法JS脚本.js
Created May 13, 2011 15:34
#QQ 云输入法 嵌入页面的 JS脚本# 其中第二行 使用了“!!q” 而不是直接使用 “q”
(function(q){
!!q?q.toggle():
(function(d,j){
j=d.createElement('script');
j.src='//ime.qq.com/fcgi-bin/getjs';
j.setAttribute('ime-cfg','lt=2');
d.getElementsByTagName('head')[0].appendChild(j)
}
)
(document)}
@Hyvi
Hyvi / code_snippet.js
Created November 8, 2011 10:57
array.map 和 sendAsBinary的兼容实现
/**
* http://javascript0.org/wiki/Portable_sendAsBinary
* portable sendAsBinary
*/
XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
function byteValue(x) {
return x.charCodeAt(0) & 0xff;
}
var ords = Array.prototype.map.call(datastr, byteValue);
/**
* 遗留的问题: 这是utf-8 ??
* 关于encodeURIComponent 与 encodeURI 的最佳实践
* http://stackoverflow.com/questions/75980/best-practice-escape-or-encodeuri-encodeuricomponent
*
Unicode Strings
In most browsers, calling window.btoa on a Unicode string will cause a Character Out Of Range exception.
To avoid this, consider this pattern, noted by Johan Sundström
@Hyvi
Hyvi / javascript_this.js
Created November 15, 2011 09:18
11.15对javascript this的理解,灾难源于这样的一段代码
/**
* 关于事件监听最佳实践  
* http://www.cnblogs.com/snowball/archive/2006/08/16/478531.html
*/
function associateObjWithEvent(obj, methodName){
return (function(e){
e = e||window.event;
// obj == DthmlObject , it's OK , but obj == new DthmlObject(),it's not
@Hyvi
Hyvi / window_size_and_scroll_bars_position.js
Created December 8, 2011 03:09
Getting window size and scroll bars position in JavaScript/DHTML
/**
* Getting window size and scroll bars position in JavaScript/DHTML
* http://www.softcomplex.com/docs/get_window_size_and_scrollbar_position.html
*/
function f_clientWidth() {
return f_filterResults (
window.innerWidth ? window.innerWidth : 0,
document.documentElement ? document.documentElement.clientWidth : 0,
document.body ? document.body.clientWidth : 0
问题:
hadoop能正常的启动,但是在mapreduce的时候出现
Lost tracker错误。datanode进程中只有一个hadoop进程。
err信息 :
#
# A fatal error has been detected by the Java Runtime Environment:
#
@Hyvi
Hyvi / 12306AutoLogin.user.js
Created January 17, 2012 02:21 — forked from kevintop/12306AutoLogin.user.js
12306 Auto Login
/*
12306 Auto Login => A javascript snippet to help you auto login 12306.com.
Copyright (C) 2011 Kevintop
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes 12306.user.js
@Hyvi
Hyvi / .vimrc
Created March 4, 2012 09:12
vim配置
nmap <F2> a<C-R>=strftime("%c")<CR><Esc>
"http://stackoverflow.com/questions/69998/tabs-and-spaces-in-vim
set tabstop=4
set shiftwidth=4
set expandtab
call pathogen#infect()
syntax on
filetype plugin indent on