Skip to content

Instantly share code, notes, and snippets.

View void285's full-sized avatar
🎯
Focusing

Leonarda void285

🎯
Focusing
View GitHub Profile
@void285
void285 / auto-fix-letsencrypt-symlink.sh
Created May 23, 2023 05:51
After migrating letsencrypt to a new server, you may encounter with errors like "SSLCertificateFile: file '/etc/letsencrypt/live/example.com/fullchain.pem' does not exist or is empty", this script fix it.
@void285
void285 / pan.baidu.com.errno.js
Last active November 28, 2021 06:36
百度网盘错误代码汇总,从页面js中整理,简单归类,可能不全
// 文件类型-category
{1:"全部视频",2:"全部音乐",3:"全部图片",4:"全部文档",6:"其它文件",7:"全部种子"}
{1:"video",2:"audio",3:"image",4:"doc",5:"app",6:"other",7:"bt",100:"visio",101:"ppt",102:"pdf",103:"txt",104:"word",105:"excel",106:"ipa",107:"apk",108:"zip"}
// 昵称
{101:"昵称已被他人占用",102:"昵称含敏感词, 请修改后再试",103:"昵称仅支持中/英文、数字及符号-和_"}
{0:"昵称最长为12个字",1:"请输入至少一个字或两个字符",2:"仅支持中/英文、数字及符号-和_"}
// 文件分享
{0:"成功","-1":"由于您分享了违反相关法律法规的文件,分享功能已被禁用,之前分享出去的文件不受影响。","-2":"用户不存在,请刷新页面后重试","-3":"文件不存在,请刷新页面后重试","-4":"登录信息有误,请重新登录试试","-5":"host_key和user_key无效","-6":"请重新登录","-7":"该分享已删除或已取消","-8":"该分享已经过期","-9":"访问密码错误","-10":"分享外链已经达到最大上限100000条,不能再次分享","-11":"验证cookie无效","-14":"对不起,短信分享每天限制20条,你今天已经分享完,请明天再来分享吧!","-15":"对不起,邮件分享每天限制20封,你今天已经分享完,请明天再来分享吧!","-16":"对不起,该文件已经限制分享!","-17":"文件分享超过限制","-30":"文件已存在","-31":"文件保存失败","-33":"一次支持操作999个,减点试试吧","-32":x,"-70":"你分享的文件中包含病毒或疑似病毒,为了你和他人的数据安全,换个文件分享吧",2:"参数错误",3:"未登录或帐号无效",4:"存储好像出问题了,请稍候再试",108:"文件名有敏感词,优化一下吧",110:"分享次数超出限制,可以到“我的分享”中查看已分享的文件链接",114:"当前任务不存在,保存失败",115:"该文件禁止分享",112:'页面已过期,请<a href="javascript:
@void285
void285 / phpcs_result_statistic.md
Created May 5, 2020 05:44
PHP CodeSniffer sniffer result statistic script.

The cmd do following actions:

  • get phpcs result
  • normalize string
  • normalize zero and non-zero numbers
  • normalize functions
  • normalize vars
  • uniq and sort
  • output
sublime.error_message(string)
sublime.message_dialog(string)
sublime.ok_cancel_dialog(string, <ok_title>)
sublime.yes_no_cancel_dialog(string, <yes_title>, <no_title>)
sublime.get_clipboard(<size_limit>)
sublime.set_clipboard(string)
sublime.View.file_name()
sublime.View.is_dirty()
sublime.View.is_scratch()
@void285
void285 / explore_json_structure.py
Last active May 4, 2020 08:33
This script helps you explore json file structure by remove [1:] elements from every array recursively. It's usefull when you have a big event giant json file and want to have a glance at it structure. It's in python2 style.
# coding: utf-8
import json
import codecs
import sys
def parse_json(data):
global depth
depth += 1
if type(data) == list:
@void285
void285 / sublime_text_session_file_structure_example.json
Last active May 4, 2020 08:41
I remove [1:] elements from every array and got this file, it shows how sublime text save session data. Main content are in window[n]-buffers, selection and buffer settings are in window[n]-groups[n]-sheets[n].
{
"workspaces": {
"recent_workspaces": [
"/D/coding/project/demo.sublime-workspace"
]
},
"settings": {
"new_window_settings": {
"menu_visible": true,
"output.mdpopups": {
# coding: utf-8
import re
import os
import codecs
import shutil
# prepare a folder as backup place
backup_path = 'd:\\backup'
# the conflict files path list, copy from everything
files = codecs.open("sync-conflict.txt", "r", "utf-8").read().strip()
173.245.48.0/20
103.21.244.0/22
103.22.200.0/22
103.31.4.0/22
141.101.64.0/18
108.162.192.0/18
190.93.240.0/20
188.114.96.0/20
197.234.240.0/22
198.41.128.0/17
@void285
void285 / apache_log_ip_statistic.sh
Created April 30, 2020 02:54
Get a sorted list of user ip from apache log
cat /var/log/apache2/mysite_access.log | awk '{print $1}' | sort | uniq -c | sort -nr
@void285
void285 / openwrt_process_watchdog.sh
Created April 26, 2020 13:33
restart process if down on openwrt
cnt=`ps | grep "kcptun" | grep -v "grep" | wc -l`
if [ $cnt -eq 0 ];then
/usr/bin/kcptun-client -c /var/etc/kcptun/client.general.json
echo "restart kcptun service at `date`" >> /root/check.log
else
echo "$cnt kcptun service on at `date`"
fi
# add this line to cron with `crontab -e`
# * * * * * /root/openwrt_process_watchdog.sh