Skip to content

Instantly share code, notes, and snippets.

import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
@kinka
kinka / gist:b0664124eff44e98d817
Last active August 29, 2015 14:17
wifi connect
TextView txtView = (TextView) findViewById(R.id.txt_ssids);
WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo info = wm.getConnectionInfo();
int strenth = info.getRssi();
int speed = info.getLinkSpeed();
String uints = WifiInfo.LINK_SPEED_UNITS;
String ssid = info.getSSID();
List<ScanResult> results = wm.getScanResults();
@kinka
kinka / animation.js
Created July 11, 2012 01:14
javascript animation helper learned from a book named HTML5 Games
window.requestAnimationFrame = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function(callback, element) {
window.setTimeout(callback, 1000/60);
};
})();
window.cancelRequestAnimationFrame = (function() {
return window.cancelRequestAnimationFrame ||
@kinka
kinka / stackedit image upload extension
Created December 26, 2016 14:43
Extend Stackedit's editor so that capable to upload image file from local system or clipboard automically
function armAutoUpload() {
var inputInsertImage = $('#input-insert-image')
inputInsertImage.append($("<input type='file' id='attach_image' accept='image/*'/>"))
var attachImage = $('#attach_image')
attachImage.change(function() {startUpload(this.files[0])})
inputInsertImage.prev('.input-group-addon')
.css({cursor: 'pointer'}).attr('title', 'click to upload image')
.click(function() {attachImage.click()})
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@kinka
kinka / 前端页面监控
Created April 30, 2017 08:34
workec.com
##开场
自我介绍, 来自tencent imweb团队的前端开发kinka, 列举工作经历(qq群, ptlogin/wtlogin, 视频云,腾讯课堂,企鹅辅导),贴出几张ptlogin登录框的图,大家都应该用过QQ登录,指出每天pv达亿级别,指出腾讯登录特有的快速登录功能;wtlogin也是大家都用过的,基本上每个腾讯的APP都会接入,虽然没有界面通常感受没那么明显,但是每次打开手Q或者微信使用Q号登录的时候,都会运行wtlogin sdk的代码。腾讯云上也开放了对应的登录能力,tls sdk,帮助大家解决基本又必须的功能。腾讯课堂是一个在线学习的平台,提供了大量的课程供大家学习,提升各方面技能,而说到企鹅辅导,可以说就是为下一代准备了。名校名师,为孩子们提供更加公平的教育环境。
广告做完了,开始进入分享主题:前端页面监控
###先抛出问题,做产品需求的时候,程序员们最关心什么?
我想多半是关心如何实现吧。好不容易理解完需求,跟产品经理进行各种PK之后,排期,开工了,开始了一个漫长的coding/debug过程,然而测试,发布,然后就收工大吉了~
突然某一天,产品过来问,上次做的某某功能,有多少人在用,用得怎么样,功能是不是达到预期了,是不是要改进?
module.exports = function ({types: t}) {
return {
// name: "ast-transform", // not required
visitor: {
Identifier(path, state) {
//path.node.name = path.node.name.split('').reverse().join('');
//console.log('test', path.node)
//path.node.name = path.node.name + '_' + loc.start.line + '_' + loc.start.column
},
FunctionDeclaration: {
[挂载ntfs分区](https://blog.csdn.net/weixin_43840399/article/details/93475915)
如果出现不可读写问题,先用 ntfsfix 修复下就可以了:https://blog.csdn.net/lanxuezaipiao/article/details/25137351