Skip to content

Instantly share code, notes, and snippets.

View hanxi's full-sized avatar
🎯
Focusing

涵曦 hanxi

🎯
Focusing
View GitHub Profile
@gaoconghui
gaoconghui / pdf_tripper.py
Last active March 9, 2025 07:15
删除pdf中指定的字(如水印 版权标记)
# -*- coding: utf-8 -*-
"""
给定一个pdf路径,以及一个列表,可修改pdf内容,删除所有符合条件的文字。
"""
from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.generic import TextStringObject, NameObject
from PyPDF2.pdf import ContentStream
from PyPDF2.utils import b_
@daurnimator
daurnimator / fengari-vue.lua
Last active June 17, 2021 11:43
Playing with Vue from fengari
-- Load Vue library
package.loadlib("https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js", "*")
-- Get Object helper
local Object = dofile("https://gist.githubusercontent.com/daurnimator/5a7fa933e96e14333962093322e0ff95/raw/8c6968be0111c7becc485a692162ad100e87d9c7/Object.lua").Object
local myapp = js.new(js.global.Vue, Object{
el = "#foo";
template = [[
<div id="foo">{{message}}</div>
]];
@doitian
doitian / sx_syslog.c
Last active March 31, 2023 04:24
skynet syslog logger
/// 使用 syslog 作为日志后端,可替代默认的 logger.
//
// 配置
//
// logservice = "sx_syslog"
// logger = "skynet.server.20170924-a577f12.ci.1"
//
// logger 配置 ident 和 syslog 选项。Ident 必须是有效的文件名,不能包含 /[] 等特殊字符。
//
// 比如可以按照下面方案
local DIRSEP = package.config:sub(1, 1)
local function is_readable(filename)
local fd = io.open(filename, "r")
if fd then
fd:close()
return true
else
return false
end
@mdonkers
mdonkers / server.py
Last active January 21, 2026 14:23
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@harv
harv / glibc-2.17_centos6.sh
Last active June 20, 2025 05:10
update glibc to 2.17 for CentOS 6
#! /bin/sh
# update glibc to 2.17 for CentOS 6
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm
sudo rpm -Uvh glibc-2.17-55.el6.x86_64.rpm \
@gwjwin
gwjwin / gfwlist2regex.py
Last active December 25, 2024 15:36 — forked from sorz/gfwlist2regex.py
Download and convert GFWList to url regex which compatible with Squid.
#!/usr/bin/env python
#encoding: utf-8
import urllib2
import re
from base64 import b64decode
LIST_URL = 'https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt'
DECODE_FILE = 'decode.txt'
BLACK_FILE = 'gfw.url_regex.lst'
local redis_c = require "resty.redis"
local ok, new_tab = pcall(require, "table.new")
if not ok or type(new_tab) ~= "function" then
new_tab = function (narr, nrec) return {} end
end
local _M = new_tab(0, 155)
adb kill-server
adb connect 127.0.0.1:53001
@nmz787
nmz787 / each_cell_on_its_own_line
Last active August 20, 2023 09:38
git-xlsx-textconv-python
import xlrd
import sys
if __name__ == '__main__':
if len(sys.argv) != 2:
print "Usage: git-xlsx-textconv file.xslx"
excelFileName = sys.argv[1]
xlFile = xlrd.open_workbook(excelFileName)