Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View wwj718's full-sized avatar

wwj718

View GitHub Profile
目标: 构建中文dsl
Date today
"hello" size
'hello' executeMethod: ('hello' class lookupSelector: #size)
[:x | Date executeMethod: (Date class lookupSelector:x) ] value: #today
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
<html>
<head>
<title>video player</title>
</head>
<body onload="onload();">
<video
id="idle_video"
onended="onVideoEnded();"
controls="controls"
></video>
'''
IoT: Internet of Things
server : iot.codelab.club
# tool:
pip3 install hbmqtt # 0.9.5
hbmqtt_pub --url mqtt://guest:test@iot.codelab.club -t "/scratch3_sub" -m "hello from hbmqtt_pub"
hbmqtt_sub --url mqtt://guest:test@iot.codelab.club -t "/scratch3_pub"
'''
import logging
# python3
'''
usage
1. download sb3 and unzip
* box2d_2_codelab_start.sb3
* rename box2d_2_codelab_start.sb3 -> box2d_2_codelab_start.zip
* unzip it: -> box2d_2_codelab_start
2. Modify content
3. zip box2d_2_codelab_start
# python3
'''
Usage:
openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
python3 simple_https_server.py
'''
import http.server, ssl
server_address = ('localhost', 8601)
httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler)
@wwj718
wwj718 / vector_animations.txt
Created January 16, 2019 11:02
List all animation names:
anim_launch_cubediscovery
anim_slowpoke_loop_04
anim_dancebeat_quit_01
anim_observing_sides_area_01
anim_message_deleted_short_01
anim_fastbump_loop_01
anim_hiking_driving_start_04
anim_cubedocking_drive_loop_01
anim_hiking_driving_start_03
anim_launch_wakeup_startdriving_01
'''
Vector:
https://developer.anki.com/vector/docs/getstarted.html
https://github.com/anki/vector-python-sdk/blob/master/examples/tutorials/02_drive_square.py
todo:
内置 anki_vector, 是否可行?
'''
import time
import threading
from scratch3_adapter import settings
import sys
from io import StringIO
import contextlib
@contextlib.contextmanager
def stdoutIO(stdout=None):
old = sys.stdout
if stdout is None:
stdout = StringIO()
sys.stdout = stdout
@wwj718
wwj718 / gist:e1ee2d4d70db379365d2826c66ae4377
Created January 5, 2019 09:11
cookiecutter-django-for-scratch-backend
➜ ~ cookiecutter https://github.com/pydanny/cookiecutter-django
You've downloaded /Users/wuwenjie/.cookiecutters/cookiecutter-django before. Is it okay to delete and re-download it? [yes]: yes
project_name [My Awesome Project]: scratch_backend
project_slug [scratch_backend]:
description [Behold My Awesome Project!]: scratch backend
author_name [Daniel Roy Greenfeld]: wwj718
domain_name [example.com]: backend.codelab.club
email [wwj718@example.com]: wuwenjie718@gmail.com
version [0.1.0]:
Select open_source_license: