Skip to content

Instantly share code, notes, and snippets.

@mo-han
mo-han / 20-mf832s.sh
Last active June 17, 2018 09:16
OpenWrt/LEDE scripts for ZTE MF832S
#!/bin/sh
MF832S_PRODUCT="19d2/199/100"
MODEM=/dev/ttyUSB0
NETIF=network.interface.mf832s
[ "$PRODUCT" = "$MF832S_PRODUCT" ] && [ "${DEVICENAME##*.}" = "4" ] || exit
[ "$ACTION" = "remove" ] &&\
{ logger -t hotplug "MF832S: detach" &&\
@mo-han
mo-han / pyseridge.py
Last active November 20, 2018 05:47
A serial port bridge monitor written by python3
#!/usr/bin/env python3
import queue
import signal
import sys
import threading
from datetime import datetime
from time import time
from serial import Serial
splinter<0.8 (0.7.x) compatible with phantomjs
selenium<3.8 (3.7.x) last version supporting phantomjs
@mo-han
mo-han / install-tag-cachedir.sh
Last active March 21, 2020 08:50
create/remove a CACHEDIR.TAG file inside the given directory
#!/bin/bash
curl -L https://gist.githubusercontent.com/mo-han/dff1e13f1fff8b5df0d1c8de57597a53/raw/69c68a0f77a0670f8d6cfa10139b7feb5a30f9f2/tag-cachedir.sh > /usr/local/bin/tagcachedir
chmod +x /usr/local/bin/tagcachedir
curl -L https://gist.githubusercontent.com/mo-han/dff1e13f1fff8b5df0d1c8de57597a53/raw/69ee94866357c69f9716449142580af9d4ea7901/untag-cachedir.sh > /usr/local/bin/untagcachedir
chmod +x /usr/local/bin/untagcachedir
@mo-han
mo-han / eh-helper-v405-mod1.userscript.js
Created February 8, 2019 17:13
E(X)Hentai Helper userscript ver 4.05 mod 1
// ==UserScript==
// @name E(X)Hentai Helper
// @description Links between E-Hentai and ExHentai page, and also links user to ExHentai automatically if gallery is "removed" and adds "view later" function
// @namespace https://greasyfork.org/en/scripts/24342-e-hentai-exhentai
// @version 4.05
// @icon https://e-hentai.org/favicon.ico
// @resource exCSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css
// @resource jqueryui https://code.jquery.com/ui/1.12.0/jquery-ui.min.js
// @include https://upload.e-hentai.org/*
@mo-han
mo-han / zip2cbz.sh
Created March 16, 2019 18:05
use zip to compress a folder into an cbz comic anchive
#!/bin/bash
for i in "$@"
do
if [ -d "$i" ]
then
parent=$(dirname "$i")
pushd $parent >/dev/null
echo $parent
dir=$(basename "$i")
@mo-han
mo-han / dir2cbz.sh
Created June 23, 2019 13:31
dir2cbz.sh
#!/bin/bash
for i in "$@"; do
if test -d "$i"; then
pushd "$i/.."
folder=$(basename "$i")
echo cbz: $folder
zip -q -0 -r "$folder.cbz" "$folder"
rm -r "$folder"
popd
@mo-han
mo-han / yt-dl.bat
Created July 7, 2019 06:41
a windows cmd script wrapper for youtube-dl
:: yt-dl.bat
:: Mo Han <[email protected]>
:: @ yt-dl_worker.bat
@echo off
setlocal
call u_var.bat
set proxy=%u_autoproxy%
rem set proxy=%u_proxy%
pushd "%u_dl%"
@mo-han
mo-han / synclock
Created July 8, 2019 17:38
a shell script for openwrt to sync system clock using ntpclient
#!/bin/sh
for i in $(seq 0 3)
do
server=$i.openwrt.pool.ntp.org
if ping -c 3 -w 3 $server >/dev/null
then
echo $server
ntpclient -s -h $server
break
@mo-han
mo-han / image-hosting-图床
Created March 21, 2020 09:02
image-hosting-图床
image-hosting-图床