Skip to content

Instantly share code, notes, and snippets.

@cwt8805
cwt8805 / pratt_parser_demo.py
Created June 9, 2023 09:55
Pratt Parser demo
from enum import Enum, auto
class TokenType(Enum):
NUMBER = auto()
OPERATOR = auto()
EOF = auto()
class Token:
def __init__(self, type, lexeme):
self.type = type
self.lexeme = lexeme
// ==UserScript==
// @name nvshens
// @namespace http://tampermonkey.net/
// @version 1.0
// @description auto page
// @author caowentao
// @match https://*.nvshens.org/g/*/
// @match https://*.gnvshen.com/g/*/
// @match https://*.fnvshen.com/g/*/
// @grant none
#!/usr/local/bin/python3
import sys
from PIL import Image, ImageFont, ImageDraw
if len(sys.argv) < 3:
print('请指定项目名称和版本号,如:Client V7.3')
sys.exit(-1)
backImg = Image.open('empty.jpg')
@cwt8805
cwt8805 / T433.go
Created June 2, 2020 02:16
调用adb logcat显示433串口信息,定时清屏
package main
import (
"fmt"
"os"
"os/exec"
"strconv"
"time"
)
@cwt8805
cwt8805 / gov_bot.go
Created April 29, 2020 07:11
中国政府采购网bot
package main
import (
"database/sql"
"fmt"
"io/ioutil"
"net/http"
"net/smtp"
"strings"
@cwt8805
cwt8805 / lmzdx.py
Created February 23, 2020 09:18
一键关注所有绿帽子大学用户
import requests
loginData = {'session[email]': '你的登录邮箱',
'session[password]': '你的账号密码'}
baseURL = "https://lmzdx.net"
session = requests.Session()
followingUsers = []
allUsers = []
def getUsersFromPage(page, tag):
@cwt8805
cwt8805 / blog.go
Created June 2, 2018 12:44
将一个包含markdown文件的目录转化为html,可用于搭建简单的blog
package main
import (
"fmt"
"html/template"
"io/ioutil"
"net/http"
"os"
"strings"
Const WIDTH = 20
Const HEIGHT = 20
Enum DATA
SNAKE_DATA
BACK_DATA
FOOD_DATA
End Enum
Enum DIR
@cwt8805
cwt8805 / Tetris.java
Created July 1, 2016 05:21
Java编写的俄罗斯方块
package tetris;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Tetris
{
public static final int FRAME_WIDTH = 305;
public static final int FRAME_HEIGHT = 525;
@cwt8805
cwt8805 / etatosthenes.c
Created January 14, 2016 03:17
Eratosthenes 算法
#include <stdio.h>
#include <stdlib.h>
#define N 10000
int main()
{
int i, j, a[N];
for (i = 2; i < N; i++) a[i] = 1;
for (i = 2; i < N; i++)
{