Skip to content

Instantly share code, notes, and snippets.

Avatar

wwj718

View GitHub Profile
View discourse_nginx.conf
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
View Teachablemachine_Result_fixed.user.js
// ==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/socket.io-client@2.2.0/dist/socket.io.slim.js
// @run-at document-end
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
You can’t perform that action at this time.