This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
from pygame.locals import * | |
import cv2 | |
import numpy as np | |
import sys | |
camera = cv2.VideoCapture(0) | |
pygame.init() | |
pygame.display.set_caption("OpenCV camera stream on Pygame") | |
screen = pygame.display.set_mode([1280,720]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install opencv-python | |
# python3.6.2 | |
#!/usr/bin/env python | |
# encoding: utf-8 | |
import numpy as np | |
import cv2 | |
cap = cv2.VideoCapture('/Users/wwj/Documents/pets.mp4') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
''' | |
python3.6.2 | |
''' | |
from moviepy.editor import * | |
import pygame | |
pygame.display.set_caption('Hello World!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import pygame | |
''' | |
说明 | |
osx python2.7 pygame1.9.2b6 | |
pygame目前只支持python2 | |
# mac 下的安装过程参考: http://blog.just4fun.site/install-pygame-on-Mac-OSX.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bit 0: left control | |
bit 1: left shift | |
bit 2: left alt | |
bit 3: left GUI (Win/Apple/Meta key) | |
bit 4: right control | |
bit 5: right shift | |
bit 6: right alt | |
bit 7: right GUI | |
#################3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import turtle | |
import time | |
# 处理python2/python3兼容性 | |
try: | |
input = raw_input | |
except NameError: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
pc 控制microbit | |
双工通道 编程风格类似socket | |
''' | |
## pc | |
import serial | |
ser = serial.Serial('/dev/tty.usbmodem1412', 9600, timeout=5) | |
data = "abc".encode("utf-8") | |
# data = bytes('abc\n',"UTF-8") | |
ser.write(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(a, b, c, d) { | |
"use strict"; | |
function e(a) { | |
return ("string" == typeof a || a instanceof String) && (a = a.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, "")), | |
a | |
} | |
var f = function(b) { | |
for (var c = b.length, d = a("head"); c--; ) | |
0 === d.has("." + b[c]).length && d.append('<meta class="' + b[c] + '" />') | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(a, b, c, d) { | |
"use strict"; | |
function e(a) { | |
return ("string" == typeof a || a instanceof String) && (a = a.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, "")), | |
a | |
} | |
var f = function(b) { | |
for (var c = b.length, d = a("head"); c--; ) | |
0 === d.has("." + b[c]).length && d.append('<meta class="' + b[c] + '" />') | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(a, b, c, d) { | |
"use strict"; | |
function e(a) { | |
return ("string" == typeof a || a instanceof String) && (a = a.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, "")), | |
a | |
} | |
var f = function(b) { | |
for (var c = b.length, d = a("head"); c--; ) | |
0 === d.has("." + b[c]).length && d.append('<meta class="' + b[c] + '" />') | |
}; |