Skip to content

Instantly share code, notes, and snippets.

View ddcatgg's full-sized avatar

DDGG ddcatgg

  • Shanghai
View GitHub Profile
@Gadgetoid
Gadgetoid / Makefile
Last active October 14, 2025 11:42
Pi 400 KB
CFLAGS_ALL=-I../libusbgx/build/include -I../bcm2835-1.68/build/include -L../bcm2835-1.68/build/lib -I../lua-5.4.0/src -L../libusbgx/build/lib -L../libserialport/build/lib -L../lua-5.4.0/src -lpng -lz -lpthread -llua -lm -lbcm2835 -ldl
pi400: CFLAGS+=-static $(CFLAGS_ALL) -lusbgx -lconfig -DPI400_USB
pi400: pi400.c gadget-hid.c
$(CC) $^ $(CFLAGS) -o $@
pi400test: CFLAGS+=-static $(CFLAGS_ALL) -lusbgx -lconfig
pi400test: pi400.c gadget-hid.c
$(CC) $^ $(CFLAGS) -o $@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import cookielib
import json
import tempfile
import mechanize
import re
import requests
@dmfigol
dmfigol / asyncio_loop_in_thread.py
Last active July 11, 2025 06:06
Python asyncio event loop in a separate thread
"""
This gist shows how to run asyncio loop in a separate thread.
It could be useful if you want to mix sync and async code together.
Python 3.7+
"""
import asyncio
from datetime import datetime
from threading import Thread
from typing import Tuple, List, Iterable
@vxgmichel
vxgmichel / aioudp.py
Last active February 24, 2025 10:28
High-level UDP endpoints for asyncio
"""Provide high-level UDP endpoints for asyncio.
Example:
async def main():
# Create a local UDP enpoint
local = await open_local_endpoint('localhost', 8888)
# Create a remote UDP enpoint, pointing to the first one

Lua简洁

Lua作为一门方便嵌入(其它应用程序)并可扩展的轻量级脚本语言来设计的, 因此, 他一直遵从着简单, 小巧, 可移植, 快速的原则, 官方实现完全采用ANSI C编写, 能以C程序库的形式嵌入到宿主程序中. Lua的每个版本都保持着开放源码的传统, 不过各版采用的许可协议并不相同, 自5.0版(最新版是5.1)开始她采用的是著名的MIT许可协议(与三条款BSD许可证内容颇为近似, 使用者可以"为所欲为"). 正由于上述特点, 所以Lua在游戏开发, 机器人控制, 分布式应用, 图像处理, 生物信息学等各种各样的领域中得到了越来越广泛的应用.

LuCI简介

Luci是Lua Configuration Interface的简称, 意在OpenWrt整个系统的配置集中化. 详见链接: http://wiki.openwrt.org/doc/uci.

LuCI的启动流程分析