Skip to content

Instantly share code, notes, and snippets.

View wwj718's full-sized avatar

wwj718

View GitHub Profile
@wwj718
wwj718 / upload2qiniu.py
Created February 6, 2017 08:05
将网站/目录整体上传到七牛云
#!/usr/bin/env python
# encoding: utf-8
'''使用:python upload2qiniu.py SITE_DIR
'''
import sys,os
from qiniu import Auth, put_file, etag, urlsafe_base64_encode,BucketManager,CdnManager
import qiniu.config
from path import path # 文档参考# https://pythontips.com/2014/01/23/python-101-writing-a-cleanup-script/
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
# https://stackoverflow.com/questions/48676566/grant-access-to-cam-mic-using-python-for-pyqt-webengine
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage
from PyQt5.QtCore import QUrl
class WebEnginePage(QWebEnginePage):
def __init__(self, *args, **kwargs):
QWebEnginePage.__init__(self, *args, **kwargs)
self.featurePermissionRequested.connect(self.onFeaturePermissionRequested)
// ==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
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
# 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 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'):