Skip to content

Instantly share code, notes, and snippets.

wwj718

Block or report user

Report or block wwj718

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mycertsdog.py
# python3 mycertsdog.py .
import logging
import sys
import time
import subprocess
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
logging.basicConfig(level=logging.DEBUG)
View sh_adapter_client.py
# pip3 install sh codelab_adpater_client
for line in sh.codelab_message_monitor(_iter=True):
print(line)
@wwj718
wwj718 / FrozenJSON.py
Created Aug 6, 2019 — forked from bonfy/FrozenJSON.py
FrozenJSON in Fluent Python
View FrozenJSON.py
"""
explore2.py: Script to explore the OSCON schedule feed
>>> from osconfeed import load
>>> raw_feed = load()
>>> feed = FrozenJSON(raw_feed)
>>> len(feed.Schedule.speakers)
357
>>> sorted(feed.Schedule.keys())
['conferences', 'events', 'speakers', 'venues']
@wwj718
wwj718 / git_count
Created Aug 1, 2019
统计三天内提交的代码数量
View git_count
git log --shortstat --author "wwj718" --since "3 day ago" \
| grep "files\? changed" \
| awk '{files+=$1; inserted+=$4; deleted+=$6} END \
{print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'
View rpi_client.py
import socket
import time
from imutils.video import VideoStream
import imagezmq
sender = imagezmq.ImageSender(connect_to='tcp://wwj-macbook.local:5555')
rpi_name = socket.gethostname() # send RPi hostname with each image
picam = VideoStream(usePiCamera=True).start()
time.sleep(2.0) # allow camera sensor to warm up
View cv_keyboard.py
import cv2
import sys
import imagezmq
image_hub = imagezmq.ImageHub()
while True: # show streamed images until Ctrl-C
rpi_name, image = image_hub.recv_image()
cv2.imshow(rpi_name, image) # 1 window for each RPi
k = cv2.waitKey(1)
# k = cv2.waitKey(0)
if k == ord('t'):
View smalltalk_block.st
"block"
a := [ :x :y | [ :z| x+y+z] ].
b := a value:1 value:2.
b value: 3
View zh_dsl.st
目标: 构建中文dsl
Date today
"hello" size
'hello' executeMethod: ('hello' class lookupSelector: #size)
[:x | Date executeMethod: (Date class lookupSelector:x) ] value: #today
View itchat_group_test.py
import itchat, time
from itchat.content import TEXT
@itchat.msg_register([TEXT])
def text_reply(msg):
# 不会接受群消息
# msg.user.send('%s: %s' % (msg.type, msg.text))
# author = itchat.search_friends(nickName='Finn')[0]
# author.send('hi ,我正通过codelab的Scratch界面与你聊天!')
content = msg.text
View video_player.html
<html>
<head>
<title>video player</title>
</head>
<body onload="onload();">
<video
id="idle_video"
onended="onVideoEnded();"
controls="controls"
></video>
You can’t perform that action at this time.