Skip to content

Instantly share code, notes, and snippets.

View tianshanghong's full-sized avatar
🚀
We feed on negative entropy.

wwang tianshanghong

🚀
We feed on negative entropy.
View GitHub Profile
@laixintao
laixintao / decent_request.py
Last active January 18, 2025 08:12
Send HTTP requests using python-requests with timeout, tcp reuse(session) and retry.
from requests.adapters import HTTPAdapter, Retry
from requests import Session
retries = Retry(
total=5, backoff_factor=1, status_forcelist=[502, 503, 504]
)
session = Session() # reuse tcp connection
session.mount("http://", HTTPAdapter(max_retries=retries))
session.mount("https://", HTTPAdapter(max_retries=retries))
@JimLiu
JimLiu / block-by-comment-likes.js
Last active December 31, 2024 01:15
微博一键拉黑点赞
// 使用方法:
// 1. Chrome打开weibo.com
// 2. 打开Chrome Dev Tool(使用 Ctrl/Cmd + Shift + I)
// 3. 在Console中复制粘贴以下代码,修改评论id为你要一键拉黑的评论ID
// 4. 回车运行
// 获取评论id方法:
// 1. 在评论下点击投诉,在新窗口中可以得到评论id,例如 https://service.account.weibo.com/reportspam?rid=XXXXXXXXXX
const cId = 123456 // 修改为真实评论ID
@frostming
frostming / fly.toml
Last active October 13, 2023 03:33
A Fly.io config file for OpenCat™ for Team that can be deployed directly
# fly.toml file generated for still-snowflake-6351 on 2023-03-30T09:53:40+08:00
kill_signal = "SIGINT"
kill_timeout = 5
primary_region = "sin"
processes = []
[build]
image = "bayedev/opencatd"

Logseq Plugin Setup Guide

[WIP] Logseq Plugin System is currently under Alpha Testing phase.

For Developers

In this short guide, it will walk you through the steps needed to set up your development environment for writing and running a hello world simple inside of Logseq Desktop Client. You know Logseq Plugin based on Web Technologies composed of JS & HTML & CSS, but neither are mandatory, you can develop plugins use any language which can be translated to javascript (Logseq made by Clojurescript!). We will use Typescript to demonstrate this sample. Because there is a type definition file to make development experience even better.

Install Node.js and NPM

@mbrock
mbrock / roam-telegram.js
Last active September 21, 2021 18:21
Roam Telegram integration PoC
// I made this in like one hour while baby was napping.
// It's a proof of concept, but I hope to improve it soon.
// In particular, I really want to grab photos from Telegram.
//
// Make a page in your Roam called [[Telegram Bot]].
//
// Put two nodes in there:
//
// API Key:: <key you get from Telegram's bot system>
// Last Update ID::
@viktorfa
viktorfa / serverless.yml
Last active February 17, 2023 20:53
Serverless config for Strapi Serverless
service: sls-strapi
provider:
name: aws
runtime: nodejs12.x
profile: <your-aws-profile>
logRetentionInDays: ${self:custom.vars.logRetentionInDays, 1}
environment:
ADMIN_JWT_SECRET: "Just using dummy"
@zhenalexfan
zhenalexfan / add_contact_pinyin.py
Created September 3, 2019 07:24
Batch add phonetic names to your Chinese contacts
import csv
from pypinyin import pinyin, lazy_pinyin, Style
def cn_char(text):
return all('\u4e00' <= char <= '\u9fff' for char in text)
if __name__ == '__main__':
data =[]
with open('contacts.csv', encoding='utf-8') as f:
@miguelmota
miguelmota / example.proto
Last active July 18, 2025 11:12
Golang protobuf marshal and unmarshal example
syntax = "proto3";
message Message {
bytes text = 1;
}
@artizirk
artizirk / gnupg_scdaemon.md
Last active June 22, 2025 17:26
OpenPGP SSH access with Yubikey and GnuPG

NB: This document describles a 'Old-School' way of using Yubikey with SSH

Modern OpenSSH has native support for FIDO Authentication. Its much simpler and should also be more stable with less moving parts. OpenSSH also now has support for signing arbitary files witch can be used as replacement of gnupg. Git also supports signing commits/tags with ssh keys.

Pros of FIDO

  • Simpler stack / less moving parts
  • Works directly with ssh, ssh-add and ssh-keygen on most computers
  • Simpler
  • Private key can never leave the FIDO device

Cons of FIDO

@dotcs
dotcs / ipv4-to-ipv6-bridge.sh
Created March 24, 2019 15:21
Script that creates an IPv4-to-IPv6 bridge
#!/usr/bin/env bash
# This script determines the IPv6 address of a given domain. The so found
# address is then used to create an IPv4-to-IPv6 tunnel from this device to the
# IPv6 address.
# [6tunnel](https://packages.debian.org/de/sid/6tunnel) is used to create the
# proxy.
#
# Usage: ./ipv6-mapper.sh <DOMAIN> <HOST_PORT=443> <TARGET_PORT=443>