Skip to content

Instantly share code, notes, and snippets.

View Senorsen's full-sized avatar
👋
Hello

Sen Zhang Senorsen

👋
Hello
View GitHub Profile
@taowen
taowen / extractTextFromPdf.md
Last active April 15, 2024 08:14
extract text from pdf

这个是油猴脚本。安装了暴力猴插件之后,点击上面这个文件的 Raw 按钮,会提示安装。

实现原理

  • pdf.js 可以提取所有的 TextItem 包括文本和包围盒
  • 根据包围盒可以大致判断一下是否换行了
  • 如果一行中包含了公式,那么一行会有很多个 TextItem,这些行会称之为 complex 的行
  • 多个连续的 complex 行变成了 complex 块
  • 如果有 claude 3 haiku 的账号会对 complex 块做一次基于图片的 OCR 来清洗嘈杂的带公式的文本
@huytd
huytd / wordle.md
Last active May 2, 2024 12:13
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@namidairo
namidairo / pppd-cve.py
Last active January 25, 2022 08:05
Xiaomi RM2100 1.0.14 vs. CVE-2020-8597
from scapy.all import *
from socket import *
interface = "enp0s31f6"
def mysend(pay,interface = interface):
sendp(pay, iface = interface)
def packet_callback(packet):
@BenjaminPoncet
BenjaminPoncet / ffmpeg-wrapper
Last active March 29, 2024 10:11
Synology VideoStation ffmpeg wrapper with DTS, EAC3 and TrueHD support. This project is no longer maintained: Please see the following projects: https://github.com/darknebular/Wrapper_VideoStation/ - https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher
#!/bin/bash
rev="12"
_log(){
echo "$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - $1" >> /tmp/ffmpeg.log
}
_log_para(){
echo "$1" | fold -w 120 | sed "s/^.*$/$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - = &/" >> /tmp/ffmpeg.log
@paulstuart
paulstuart / flatten.sh
Created June 25, 2019 19:18
A script to "flatten" and "unflatten" JSON structures
#!/bin/bash
# Convert json data to a dotted notation for line-based manipulation and visualization
#
# Adapted from dialog here: https://news.ycombinator.com/item?id=20245913
# jq code by @jolmg
#
flat() {
jq -r '
@aveao
aveao / amsemummc.md
Last active March 12, 2020 15:45
setting up ams partition based emummc on linux

Setting up emummc in a nutshell (mostly for linux)

  • update atmosphere to 0.9.2 on your microsd. Also ensure that your microSD is MBR, not GPT (gparted calls this msdos).
  • if you want to use an old backup, grab those files, you'll need them. If not, boot into hekate, dump raw gpp and boot0/1.
  • combine all files on your pc, in the order of boot0, boot1 and rawnand (cat BOOT0 BOOT1 rawnand.bin.00 rawnand.bin.01 rawnand.bin.02 rawnand.bin.03 rawnand.bin.04 rawnand.bin.05 rawnand.bin.06 rawnand.bin.07 rawnand.bin.08 rawnand.bin.09 rawnand.bin.10 rawnand.bin.11 rawnand.bin.12 rawnand.bin.13 rawnand.bin.14 > emummc.bin). Resulting file should be 31276924928 bytes unless you modded your console with a larger (or a smaller) emmc (if you don't know what this is about, then you haven't modded yours).
  • create a fat32 partition on your microsd of the same size as the resulting file you just created (can be a bit bigger, do it a bit [100MiB or so] bigger if you want to be safe), dd the combined file to it with
@Jimmy-Z
Jimmy-Z / services-start.sh
Created February 28, 2019 08:42
multi SSID with VLAN script, for ASUS AC86U with merlin
#!/bin/sh
# multi SSID with VLAN script, for ASUS AC86U with merlin
#
# setup before hand:
# set "router" to "AP Mode"
# this will put all ports and wireless in br0
# create 2 guest network
# enable Administration => System => Enable JFFS custom scripts and configs
# put this script in /jffs/scripts/, name should be "services-start"
@Acris
Acris / build-shadowsocks-libev-for-asuswrt-merlin.sh
Last active November 7, 2023 08:18
Build shadowsocks-libev for asuswrt-merlin
#!/bin/bash
set -e
# libev version
LIBEV_VER=4.27
# mbedTLS version
MBEDTLS_VER=2.16.2
# libsodium version
@LordShedy
LordShedy / guide.md
Created January 21, 2019 18:30
How to make AirPods work with linux (Debian 4.9.0-8-amd64)

Steps

  1. set "ControllerMode = bredr" in /etc/bluetooth/main.conf

  2. sudo /etc/init.d/bluetooth restart

  3. pair again.