#define CFG_TUD_MSC 1 #define EPNUM_MSC_OUT 0x03 #define EPNUM_MSC_IN 0x83 #define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN + TUD_MSC_DESC_LEN) uint8_t const desc_fs_configuration[] = { TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100), TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_0, 4, EPNUM_CDC_0_NOTIF, 8, EPNUM_CDC_0_OUT, EPNUM_CDC_0_IN, 64), TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 0, EPNUM_MSC_OUT, EPNUM_MSC_IN, 64), }; add msc_disk.c #include "tusb.h" #if CFG_TUD_MSC enum { DISK_BLOCK_NUM = 16, // 8KB DISK_BLOCK_SIZE = 512 }; #define README_CONTENTS \ "TinyUSB MSC on MM32F0163D7P\r\n\r\n\ CDC + MSC Composite Device Demo" uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] = { // Block0: Boot Sector (FAT12) { 0xEB, 0x3C, 0x90, 0x4D, 0x53, 0x44, 0x4F, 0x53, 0x35, 0x2E, 0x30, 0x00, 0x02, 0x01, 0x01, 0x00, 0x01, 0x10, 0x00, 0x10, 0x00, 0xF8, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x29, 0x34, 0x12, 0x00, 0x00, 'T' , 'i' , 'n' , 'y' , 'U' , 'S' , 'B' , ' ' , 'M' , 'S' , 'C' , 0x46, 0x41, 0x54, 0x31, 0x32, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xAA }, // Block1: FAT12 Table { 0xF8, 0xFF, 0xFF, 0xFF, 0x0F }, // Block2: Root Directory { 'T' , 'i' , 'n' , 'y' , 'U' , 'S' , 'B' , ' ' , 'M' , 'S' , 'C' , 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x6D, 0x65, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 'R' , 'E' , 'A' , 'D' , 'M' , 'E' , ' ' , ' ' , 'T' , 'X' , 'T' , 0x20, 0x00, 0xC6, 0x52, 0x6D, 0x65, 0x43, 0x65, 0x43, 0x00, 0x00, 0x88, 0x6D, 0x65, 0x43, 0x02, 0x00, sizeof(README_CONTENTS)-1, 0x00, 0x00, 0x00 }, // Block3: Readme Content README_CONTENTS }; uint8_t tud_msc_get_maxlun_cb(void) { return 1; // single LUN } void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) { (void) lun; const char vid[] = "MM32"; const char pid[] = "CDC+MSC"; const char rev[] = "1.0"; memcpy(vendor_id , vid, strlen(vid)); memcpy(product_id , pid, strlen(pid)); memcpy(product_rev, rev, strlen(rev)); } bool tud_msc_test_unit_ready_cb(uint8_t lun) { (void) lun; return true; } void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size) { (void) lun; *block_count = DISK_BLOCK_NUM; *block_size = DISK_BLOCK_SIZE; } bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) { (void) lun; (void) power_condition; (void) start; (void) load_eject; return true; } int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize) { (void) lun; if (lba >= DISK_BLOCK_NUM) return -1; memcpy(buffer, msc_disk[lba] + offset, bufsize); return bufsize; } bool tud_msc_is_writable_cb(uint8_t lun) { (void) lun; return true; } int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize) { (void) lun; if (lba >= DISK_BLOCK_NUM) return -1; memcpy(msc_disk[lba] + offset, buffer, bufsize); return bufsize; } void tud_msc_eject_cb(uint8_t lun) { (void) lun; } int32_t tud_msc_scsi_cb(uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize) { (void) lun; (void) scsi_cmd; (void) buffer; tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00); return -1; } #endif switch to ARM Compiler 6 ...
Hugo Nginx
nginx cfg location /webhook/ { allow 140.82.112.0/20; allow 192.30.252.0/22; allow 185.199.108.0/22; allow 127.0.0.1; deny all; proxy_pass http://127.0.0.1:9000/hooks/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 120s; proxy_buffering off; } location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot|webp)$ { expires 30d; add_header Cache-Control "public, immutable"; log_not_found off; access_log off; } location ~* \.(html|htm|xml|txt|json)$ { expires 1h; add_header Cache-Control "public"; } location ~ /\. { deny all; access_log off; log_not_found off; } location ~* \.(sql|bak|backup|sh|log|ini|conf|yml|yaml|md)$ { deny all; return 404; } /etc/systemd/system/webhook.service [Unit] Description=Webhook Service After=network.target [Service] Type=simple User=root Group=root ExecStart=/usr/local/bin/webhook -ip 127.0.0.1 -port 9000 -hooks /etc/webhook/hooks.json -verbose Restart=always RestartSec=5 [Install] WantedBy=multi-user.target deploy #!/bin/bash SOURCE_DIR="/home/anthony/blog-source" WEB_DIR="/var/www/blog" LOG_FILE="/var/log/webhook/deploy.log" echo "$(date): ========== start deploy ==========" >> $LOG_FILE cd $SOURCE_DIR || { echo "$(date): ERROR: cannot enter $SOURCE_DIR" >> $LOG_FILE exit 1 } echo "$(date): fetching remote updates" >> $LOG_FILE git fetch origin >> $LOG_FILE 2>&1 echo "$(date): force sync with remote main branch" >> $LOG_FILE git reset --hard origin/main >> $LOG_FILE 2>&1 echo "$(date): updating submodules" >> $LOG_FILE git submodule update --init --recursive >> $LOG_FILE 2>&1 echo "$(date): generating static files" >> $LOG_FILE hugo --destination $WEB_DIR --minify -D >> $LOG_FILE 2>&1 echo "$(date): setting permissions" >> $LOG_FILE chmod -R 755 $WEB_DIR >> $LOG_FILE 2>&1
webhook
webhook status sudo systemctl daemon-reload sudo systemctl restart webhook sudo systemctl status webhook sudo netstat -tlnp | grep webhook webhook.service vi /etc/systemd/system/webhook.service deploy.sh vi /usr/local/bin/deploy.sh log tail -f /var/log/webhook/deploy.log