Skip to content

Instantly share code, notes, and snippets.

View x1ah's full-sized avatar
:octocat:
In pain

x1ah x1ah

:octocat:
In pain
View GitHub Profile
@x1ah
x1ah / c.gif
Last active July 4, 2020 04:58
cat
c.gif
@binderclip
binderclip / wechat_mp_msgs.txt
Last active March 26, 2018 09:31
微信服务号请求消息格式
// 本来的数据是 XML 的,手动转换成了 json 格式
// 文本消息
{
"ToUserName": "gh_555555555555",
"FromUserName": "o3QQQQQQQQQQQQQQQQQQQQQQQQQQ",
"CreateTime": "1520247736",
"MsgType": "text",
"Content": "红包",
"MsgId": "6529414308333333333"
@alairock
alairock / exceptions.py
Last active May 13, 2024 18:07
Python Async Retry Decorator.
class TooManyTriesException(BaseException):
pass
@awanabe
awanabe / BaseSpiderClass.py
Last active March 11, 2018 15:36
爬虫基类
# coding=utf-8
import time
from datetime import datetime
from threading import Thread
from redis import StrictRedis
from redis.exceptions import ConnectionError
@hxer
hxer / log.py
Last active September 18, 2021 14:37
python logging 将日志同时输出文件和屏幕
# 日志打印屏幕或文件
def setup_logger_2(logger_name, level=logging.INFO, handler='all', log_file=''):
"""
:param logger_name:
:param log_file:
:param level:
:param handler: file or stream or all
:return:
"""
log_setup = logging.getLogger(logger_name)
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active June 10, 2024 17:21 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@abrasumente233
abrasumente233 / nesign.py
Last active June 26, 2022 01:46
网易云音乐签到(pc android)
# -*- coding: utf-8 -*-
"""网易云自动签到"""
import requests
__author__ = 'abrasumente'
@binderclip
binderclip / deploy-flask-gunicorn-supervisor-nginx.md
Last active March 22, 2023 09:17
Flask Gunicorn Supervisor Nginx 项目部署小总结

Flask Gunicorn Supervisor Nginx 项目部署小总结

服务器的基本连接和配置

SSH 连接

使用公钥私钥来登陆而不是账号密码,公钥私钥需要简单的在本地生成一下。Github 的生成 SSH 公钥私钥的教程:Generating SSH keys

可能需要使用 -i 参数选择一下本地的私钥,一个示例的 ssh 连接如下:

# zsh
EMOJI=(💩 🐦 🚀 🐞 🎨 🍕 🐭 👽 ☕️ 🔬 💀 🐷 🐼 🐶 🐸 🐧 🐳 🍔 🍣 🍻 🔮 💰 💎 💾 💜 🍪 🌞 🌍 🐌 🐓 🍄 )
function random_emoji {
echo -n "$EMOJI[$RANDOM%$#EMOJI+1]"
}
PROMPT="$(random_emoji) "
RPROMPT='%c'
@xavierskip
xavierskip / snake.py
Last active February 24, 2023 12:21
snake in terminal
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
import time
import random
class Snake():
def __init__(self,length,screen):
# left top coordinate (y,x)