Skip to content

Instantly share code, notes, and snippets.

View monsterxcn's full-sized avatar
🥱
上班!

Monst.x monsterxcn

🥱
上班!
View GitHub Profile
@monsterxcn
monsterxcn / PythonLearning-Day1.md
Last active April 24, 2020 14:14
Python 要点备忘

数据类型

  • int 整型。任意大小的整数,支持多种进制。
    • 0b100 二进制
    • 0o100 八进制
    • 0x100 十六进制
  • float 浮点型。支持数学写法 123.456 和科学计数写法 1.234e5
  • str 字符串型。
    • 一般用单引号 ' 或双引号 " 包住
  • 使用 \ 转义引号,或者使用与字符串内引号不同的引号
@monsterxcn
monsterxcn / CentOS7-code.md
Last active April 28, 2020 02:41
LinuxNote

Install Code Server and bind a domain on CentOS 7

Oneinstack

# yum -y install wget screen
# wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz
# tar xzf oneinstack-full.tar.gz
# cd oneinstack
# screen -S oneinstack

在子目录安装 Typecho 和 WordPress 的 Nginx 配置备忘

Typecho

  location /typechoDir/ {
    if (!-e $request_filename) {
      rewrite ^(.*)$ /typechoDir/index.php$1 last;
    }
  }
@monsterxcn
monsterxcn / keys.sh
Created July 31, 2021 12:13
set authorized_keys by @lengthmin/lengthm.in
#!/bin/sh
# https://github.com/lengthmin/lengthm.in
# set authorized_keys
# curl lengthm.in/keys.sh | sh
exists() {
command -v "$1" >/dev/null 2>&1
}
@monsterxcn
monsterxcn / .bashrc
Created August 11, 2021 12:20
WSL2 代理设置脚本
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
###
# proxy for wsl2
# run this after modification
# source ~/.bashrc
alias wslproxy="source /home/tingle/.proxy.sh"
@monsterxcn
monsterxcn / set-docker-cn-mirror.sh
Created August 15, 2021 03:11
Docker cn mirror
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://kxqx9fw7.mirror.aliyuncs.com",
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"http://f1361db2.m.daocloud.io"
]
}
@monsterxcn
monsterxcn / epicfree.py
Last active August 16, 2021 08:50
通过 Python 获取 Epic Game Store 免费游戏提醒!更多更全的 Epic Game Store Web API 可通过 python 包 epicstore_api 获取
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
获取免费游戏的网络请求方式来自 RSSHub /epicgames 路由
https://github.com/DIYgod/RSSHub/blob/master/lib/routes/epicgames/index.js
处理免费游戏的信息方法借鉴 pip epicstore_api 示例
https://github.com/SD4RK/epicstore_api/blob/master/examples/free_games_example.py
@monsterxcn
monsterxcn / extend-image.py
Created August 17, 2021 14:12
将指定前缀的 RGBA PNG 图片文件宽度增加 13px,且保持左对齐状态。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from PIL import Image
# 所有待替换的前缀规则,文件名应类似于:talent.Mondstadt.png talent.Mondstadt.1.png weapon.Liyue.5.png talent.Inazuma.3.png
startFlags = ['talent.Mondstadt', 'weapon.Mondstadt', 'talent.Liyue', 'weapon.Liyue', 'talent.Inazuma', 'weapon.Inazuma']
# 建议将此文件存至图片集同文件夹内
@monsterxcn
monsterxcn / nonebot_plugin_checkin.py
Last active August 21, 2021 01:05
Nonebot2 HEU 平安行动打卡插件,基于 Playwright 的模拟浏览器操作,无需 formData 等数据。但是务必保证事先填写并提交了一遍正确数据!代码仅学习使用
import nonebot
from nonebot import require
from nonebot.adapters.cqhttp import Bot, Message
from nonebot.adapters.cqhttp.event import MessageEvent
from nonebot.log import logger
from nonebot.plugin import on_command
from nonebot.typing import T_State
import time
from playwright.async_api import async_playwright