Skip to content

Instantly share code, notes, and snippets.

@JiapengLi
JiapengLi / esp32-s3-circuitpython-key-led.py
Created January 2, 2023 10:45
An example for ESP32-S3 circuitpython board, key control and simple led breathing effect
import time
import board
import neopixel_write
import digitalio
class LED:
def __init__(self, pin):
self.pin = digitalio.DigitalInOut(pin)
self.pin.direction = digitalio.Direction.OUTPUT
self.ts = self.ms
@JiapengLi
JiapengLi / deploy-streamr-docker-compose.md
Last active April 6, 2022 04:15
deploy streamr docker compose file

docker-compose.yaml

version: "3"
services:
  streamr-miner:
    restart: always
    image: streamr/broker-node:latest
    container_name: streamr
    init: true
 privileged: true
import os, sys
import datetime
import re
import json
import time
from math import radians, cos, sin, asin, sqrt, log10, pow, pi
from numpy import random
import concurrent
@JiapengLi
JiapengLi / flomo.py
Last active April 20, 2021 03:31
使用命令行创建flomo
#!/bin/env python
# -*- coding: UTF-8 -*-
import os, sys, re
import requests
import subprocess
'''
## 使用方法
from PYKB import *
keyboard = Keyboard()
___ = TRANSPARENT
BOOT = BOOTLOADER
L1 = LAYER_TAP(1)
L2D = LAYER_TAP(2, D)
@JiapengLi
JiapengLi / certbot-systemd-ubuntu.md
Created August 24, 2020 07:35 — forked from dbirks/certbot-systemd-ubuntu.md
Certbot renew with a systemd timer on Ubuntu

Ubuntu 16.04

/etc/systemd/system/certbot.service

[Unit]
Description=Let's Encrypt renewal

[Service]
Type=oneshot
ExecStart=/usr/bin/certbot renew --quiet --agree-tos
# ubuntu 14.04
sudo apt install -y build-essential libssl-dev zlib1g-dev libpam0g-dev
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam
make
sudo make install

Note: don't worry, configuration files under /etc/ssh will not be overwritten .

// https://tools.ietf.org/html/rfc4648
// https://en.wikipedia.org/wiki/Base32
const char base32_tab[32] = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
int bin2base32hex(uint8_t *buf, int len, char *base32, bool pad)
{
int i, j, k, cnt = 0;
uint8_t val = 0;
int padnum;
padnum = 8-((len*8+4)/5)%8;
@JiapengLi
JiapengLi / rtt-kernel-modificaiton-2016-2017.patch
Last active December 13, 2018 09:57
RT-Thread kernel modification from 2016 to 2017 (2015-11-23 ~ 2017-08-25)
diff --git a/include/components.h b/include/components.h
index 4113a869..57c0c026 100644
--- a/include/components.h
+++ b/include/components.h
@@ -63,8 +63,8 @@
#ifdef RT_USING_DFS_YAFFS2
#include <dfs_yaffs2.h>
#endif
-#ifdef RT_USING_DFS_ROMFS
-#include <dfs_romfs.h>

Version

Enjoy OpenWrt Cocktail. Openwrt Histroy

DESIGNATED DRIVER

 _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|

|__| W I R E L E S S F R E E D O M