Skip to content

Instantly share code, notes, and snippets.

View tsl0922's full-sized avatar
💭
I may be slow to respond.

Shuanglei Tao tsl0922

💭
I may be slow to respond.
View GitHub Profile
@tsl0922
tsl0922 / main.c
Created August 13, 2024 10:07
stm32 RGB led and buzzer demo (R/G/B: PA0/PA1/PA2, Buzzer: PA6).
#include "stm32f10x.h"
void Delay_us(uint32_t xus) {
SysTick->LOAD = 72 * xus;
SysTick->VAL = 0x00;
SysTick->CTRL = 0x00000005;
while(!(SysTick->CTRL & 0x00010000));
SysTick->CTRL = 0x00000004;
}
Ctrl+o script-message-to dialog open #menu: Open > Files...
Ctrl+O script-message-to dialog open-folder #menu: Open > Folder...
_ script-message-to dialog open append #menu: Open > Add To Playlist...
_ ignore #menu: Open > -
_ script-message-to dialog open bd-iso #menu: Open > Bluray ISO...
_ script-message-to dialog open dvd-iso #menu: Open > DVD ISO...
_ ignore #menu: Open > -
Ctrl+v script-message-to dialog open-clipboard #menu: Open > Clipboard
_ ignore #menu: Open > -
Ctrl+R script-binding recentmenu/open #menu: Open > Recently Played #@recent
@tsl0922
tsl0922 / code.py
Created April 13, 2023 10:25
LuatOS ESP32C3-CORE CircuitPython example code for 1.8 inch, 128x160, ST7735 TFT display
import time
import board
import busio
import displayio
import terminalio
from adafruit_display_text import label
from adafruit_display_shapes.rect import Rect
from adafruit_display_shapes.circle import Circle
from adafruit_display_shapes.roundrect import RoundRect
from adafruit_display_shapes.triangle import Triangle
@tsl0922
tsl0922 / display.ini
Last active April 14, 2023 03:02
LuatOS ESP32C3-CORE Tasmota Universal Display Driver for 1.8 inch, 128x160, ST7735 TFT display
:H,ST7735,128,160,16,SPI,1,7,2,3,6,11,10,*,27
:S,1,1,1,0,10,10
:I
EF,3,03,80,02
CF,3,00,C1,30
ED,4,64,03,12,81
E8,3,85,00,78
CB,5,39,2C,00,34,02
F7,1,20
EA,2,00,00
@tsl0922
tsl0922 / platformio.ini
Last active March 15, 2024 15:21
LuatOS ESP32C3-CORE PlatformIO config
; Board Spec: https://wiki.luatos.com/chips/esp32c3/board.html
[env:esp32-c3-devkitm-1]
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino
board_build.flash_mode = dio
board_build.extra_flags =
-DARDUINO_ESP32C3_DEV
-DARDUINO_USB_MODE=1
@tsl0922
tsl0922 / clear-actions-cache.sh
Created October 9, 2022 16:14
Clear github actions cache
REPO="OWNER/REPO"
TOKEN="TOKEN"
for id in $(curl -s \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${TOKEN}" \
https://api.github.com/repos/${REPO}/actions/caches | jq -r '.actions_caches[] | .id'); do
echo "Deleting cache with id: $id..."
curl -X DELETE \
-H "Accept: application/vnd.github.v3+json" \
@tsl0922
tsl0922 / git-replay.sh
Last active September 27, 2022 02:15
Replay a range of git commit in another repo (git format-patch + git am with merge commit support)
#!/bin/bash
set -eo pipefail
SRC_REPO=""
TARGET_REPO=""
RANGE=""
# generate patches
patch_gen() {
@tsl0922
tsl0922 / auth_config.yml
Created December 6, 2017 02:08
docker registry authentication server without tls (useful for using with ELB)
# A simple example. See reference.yml for explanation for explanation of all options.
#
# auth:
# token:
# realm: "http://127.0.0.1:5001/auth"
# service: "Docker registry"
# issuer: "Acme auth server"
# rootcertbundle: "/path/to/server.pem"
#
# openssl req -newkey rsa:2048 -nodes -keyout server.key -x509 -days 365 -out server.crt
#!/bin/bash
#
# Bash script to setup headless Selenium (uses Xvfb and Chrome)
# (Tested on Ubuntu 12.04) trying on ubuntu server 14.04
# Add Google Chrome's repo to sources.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
# Install Google's public key used for signing packages (e.g. Chrome)
# (Source: http://www.google.com/linuxrepositories/)
@tsl0922
tsl0922 / .tmux.conf
Last active December 5, 2024 08:54
vim style tmux config
# vim style tmux config
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Easy config reload
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."