Skip to content

Instantly share code, notes, and snippets.

package com.example.touch;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.ConsoleMessage;
import android.webkit.WebChromeClient;
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<style>
body {
background-color: darkkhaki;
width: 360px;
height: 600px;
}
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import cv2
im = cv2.imread('h.png')
cv2.imshow('你好', im)
cv2.waitKey()
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import cv2
cap = cv2.VideoCapture(0)
while True:
ret,im = cap.read()
cv2.imshow('video test',im)
#!/usr/bin/python
# -*- coding: UTF-8 -*-
packageCounts='600,500,300,100'.split(',')
packageSum=0
temp=[]
subPackageCounts=[]
for i in range(len(packageCounts)):
currentCount=int(packageCounts[i])
@MarshalW
MarshalW / rendersphere.py
Created August 14, 2013 08:55
PyOpenGL简单示例
#!/usr/bin/env python
#
#
# 3.1.3 added toggle on for shader by pressing "g" (for glsl). Doesn't seem to
# want to toggle back off. plVShader looks identical to phong. To see toon
# shader change lines 163 and 164 to vShader = toonVShader
# and fShader = toonFShader
#
# 3.1.4 Attempting to add a more complex shader! I may add some more lights
# too
var cluster=require('cluster');
if(cluster.isMaster){
console.log('is master');
var worker=cluster.fork();
worker.on('message',function(message){
console.log('master recieve message: '+message);
});
process.on('exit',function(){
console.log('process exit');
package marshal.opencvproto;
import org.opencv.core.Mat;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
var mqtt = require('mqtt');
//{'topicName':[clientObj,clientObj ..]}
var subscribeTopics={};
//创建服务器对象
var server = mqtt.createServer(function(client) {
//建立连接时触发
client.on('connect', function(packet) {
#!/bin/bash
safeRunCommand() {
typeset cmnd="$*"
typeset ret_code
echo cmnd=$cmnd
eval $cmnd
ret_code=$?
if [ $ret_code != 0 ]; then