Skip to content

Instantly share code, notes, and snippets.

View WangYihang's full-sized avatar
🎯
Focusing

Yihang Wang WangYihang

🎯
Focusing
View GitHub Profile
import sys
import base64
import requests
import string
STANDARD_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
CUSTOM_ALPHABET = 'gx74KW1roM9qwzPFVOBLSlYaeyncdNbI=JfUCQRHtj2+Z05vshXi3GAEuT/m8Dpk6'
def encode(data):
table = data.maketrans(STANDARD_ALPHABET, CUSTOM_ALPHABET)
@WangYihang
WangYihang / play-super-mario-theme-with-pi.py
Last active August 14, 2020 03:22
Play super mario theme with passive buzzer on Raspberry Pi.
# Inspired from: https://create.arduino.cc/projecthub/jrance/super-mario-theme-song-w-piezo-buzzer-and-arduino-1cc2e4
from gpiozero import TonalBuzzer
from gpiozero.tones import Tone
import time
music = {
"recipe":["overworld", "overworld", "underworld"],
"overworld": [
("E5", 12), ("E5", 12), (None, 12), ("E5", 12),
# encoding:utf-8
import gpiozero
import time
import sys
class Broadcast:
def __init__(self, gpio):
self.buzzer = gpiozero.Buzzer(gpio)
self.unit = 0.04
self.breath = self.unit * 0.5
#!/usr/bin/env python3
# encoding: utf-8
import time
import requests
import os
import difflib
from notify_run import Notify
'''
@WangYihang
WangYihang / archive.py
Created May 21, 2020 11:36
用于 zip 批量打包目录
import glob
import os
folders = glob.glob("./*/*")
cwd = os.getcwd()
for folder in folders:
os.chdir("{}{}".format(cwd, folder))
command = "zip -9r {}.zip .".format(os.getcwd())
print(command)
import win32process
import win32gui
def list_windows_active():
processes = list_processes()
windows = {}
def callback(hwnd, process):
if win32gui.IsWindowVisible(hwnd) and win32process.GetWindowThreadProcessId(hwnd)[1] == process.pid:
text = win32gui.GetWindowText(hwnd)
if text != "":
@WangYihang
WangYihang / .gitignore
Created April 4, 2020 09:00
HIWIFI-SS-Scheduler
__pycache__
config.py
import os
import requests
base_urls = {
"6": "https://s3.ananas.chaoxing.com/doc/a7/8c/7b/8311edb8d337c6d0ddd0dfbd72de8950/thumb/",
"7": "https://s3.ananas.chaoxing.com/doc/97/0c/e2/6a2fc3a5c34560dc387803e06a0c2abd/thumb",
"8": "https://s3.ananas.chaoxing.com/doc/28/3b/47/efbdfc0ba48a5247668a9b64600a03c8/thumb/",
"9": "https://s3.ananas.chaoxing.com/doc/9e/8a/23/d6f06ae6ef23810ef6d50a15cf733e1b/thumb/",
"10": "https://s3.ananas.chaoxing.com/doc/6a/1e/47/3c5f134cea0eab8edb11653e23f02ebb/thumb/",
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles": {
"defaults": {
// Put settings here that you want to apply to all profiles
"acrylicOpacity" : 0.5,
"cursorShape" : "filledBox",
\documentclass{beamer}
% import packages
\usepackage{minted}
\usepackage{bookmark}
% set theme and corlor theme
\usetheme{Rochester}
\usecolortheme{seahorse}