Skip to content

Instantly share code, notes, and snippets.

View wwj718's full-sized avatar

wwj718

View GitHub Profile
import time
import base64
import pathlib
import re
import itertools
import io
from loguru import logger
from codelab_adapter_client import AdapterNode
from codelab_adapter_client.utils import get_or_create_node_logger_dir, open_path_in_system_file_manager, install_requirement
server {
listen 80; listen [::]:80;
server_name forums.codelab.club; # <-- change this
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2; listen [::]:443 ssl http2;
server_name forums.codelab.club; # <-- change this
// ==UserScript==
// @name Teachablemachine Result
// @namespace http://tampermonkey.net/
// @version 0.5
// @description try to take over the world!
// @author You
// @match *://teachablemachine.withgoogle.com/*
// @grant none
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/socket.io.slim.js
// @run-at document-end
# 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)
# pip3 install sh codelab_adpater_client
for line in sh.codelab_message_monitor(_iter=True):
print(line)
@wwj718
wwj718 / FrozenJSON.py
Created August 6, 2019 04:20 — forked from bonfy/FrozenJSON.py
FrozenJSON in Fluent Python
"""
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 August 1, 2019 06:03
统计三天内提交的代码数量
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}'
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
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'):
"block"
a := [ :x :y | [ :z| x+y+z] ].
b := a value:1 value:2.
b value: 3