Skip to content

Instantly share code, notes, and snippets.

View syhily's full-sized avatar
🎯
Focusing

Yufan Sheng syhily

🎯
Focusing
View GitHub Profile
@syhily
syhily / goimports.sh
Last active December 21, 2022 11:59
A custom goimports script with better -local sorting support. Used in pre-commit hooks.
#!/bin/bash
## This shell script is used with https://github.com/TekWizely/pre-commit-golang
# You should add it to your .pre-commit-config.yaml file with the options like
#
# - repo: https://github.com/tekwizely/pre-commit-golang
# rev: v1.0.0-rc.1
# hooks:
# - id: go-mod-tidy-repo
# - id: golangci-lint-mod
@syhily
syhily / curl_tianlangbooks.sh
Last active February 2, 2025 03:33
抓取天浪书屋的蓝奏云下载链接
for((i=1;i<=10302;i++));
do
echo ""
echo ""
echo "Start download book from $i"
echo ""
echo ""
curl "https://www.tianlangbooks.com/$i.html" -H 'authority: www.tianlangbooks.com' --data-raw 'secret_key=359198&Submit=%E6%8F%90%E4%BA%A4' --compressed | grep "蓝奏云盘" >> download.txt
done
@syhily
syhily / docker-compose.yml
Last active October 26, 2022 11:42
Miniflux on Synology Docker
version: "3.4"
services:
miniflux:
image: miniflux/miniflux:latest
container_name: miniflux
depends_on:
- rsshub
- postgres
ports:
- 1541:8080
@syhily
syhily / bootstrap.sh
Last active June 4, 2022 15:58
How to use docker talebook with MySQL.
#!/usr/bin/env bash
# Patch current talebook for adding permission
grep -qxF 'user.permission = ' /var/www/talebook/webserver/handlers/user.py || sed -i '/user.email = email/a \ \ \ \ \ \ \ \ user.permission = '\''DEPRU'\''' /var/www/talebook/webserver/handlers/user.py
# Start talebook
source /var/www/talebook/docker/start.sh
@syhily
syhily / download_talebook.sh
Last active September 24, 2025 08:37
Download all the books from a talebook website. The https://curl.se/ and https://stedolan.github.io/jq/ are required for using this script.
#!/usr/bin/env bash
# Download metadata, modify these as your needs.
## The directory to save the downloaded files.
download_directory="/volume1/Download/EPUB"
## The website you want to visit.
calibre_site="http://soulseeker.myds.me:25788"
## The formats you want to download. We only download the first present format.
## All the formats should be upper case.
allow_formats=( EPUB MOBI AZW3 )
@syhily
syhily / sync_fork.sh
Last active November 14, 2021 08:27
Update git fork with tags and selected branches.
# Repo: apache/flink
# Fork: streamnative/flink
# Prepare the working enviroment
## Clone the forked repository
git clone git@github.com:streamnative/flink.git
## Add the original repository as the upstream git remote
git remote add upstream git@github.com:apache/flink.git
@syhily
syhily / build-protoc.sh
Created January 21, 2021 09:54
Build protoc.exe for Apple M1
#!/bin/bash
# Builds protoc executable into target/<OS>/<ARCH>/protoc.exe; optionally builds
# protoc plugins into target/<OS>/<ARCH>/protoc-gen-*.exe
#
# Usage: ./build-protoc.sh <OS> <ARCH> <TARGET>
#
# <TARGET> can be "protoc" or "protoc-gen-javalite". Supported <OS> <ARCH>
# combinations:
# HOST <OS> <ARCH> <COMMENT>
@syhily
syhily / ThunderPlugInsDeleter-macOS.sh
Created January 15, 2021 01:10
这段脚本可以让macOS上迅雷的外观更加简洁
cd /Applications/Thunder.app/Contents/PlugIns
rm -rf featuredpage.* advertising.* xlbrowser.* activitycenter.* xlplayer.* xiazaibao.* iOSThunder.* searchtask.* lixianspace.* softmanager.* webgame.* livestream.*
package json
import (
"bytes"
"fmt"
"io"
"net/http"
"strings"
"github.com/gin-gonic/gin/binding"
package main
import (
"fmt"
"math/rand"
"time"
)
const (
width = 80