Skip to content

Instantly share code, notes, and snippets.

Ang Li meoow

View GitHub Profile
@meoow
meoow / bdcurl.sh
Last active Feb 19, 2020
百度云命令行(bash)上传下载脚本
View bdcurl.sh
#!/bin/bash
# Baidu Yun Command Line Interface
# Depends: bash, curl, grep, awk, sed, od
# (They are basicly builtin tools of any *nix system.)
# Additionally, fastupload depends: head, wc, md5sum or md5, cksum
# (Which are also builtin tools)
#### Variables ####
@meoow
meoow / write-clip-down.applescript
Last active Oct 6, 2018
write text from the clipboard to text file inside path finder or finder's current directory
View write-clip-down.applescript
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
on writeclipdown(filepath)
try
set f to open for access file filepath with write permission
set eof of f to 0
set olddel to AppleScript's text item delimiters
set AppleScript's text item delimiters to {return & linefeed, return, linefeed, character id 8233, character id 8232}
set newText to text items of (get the clipboard)
@meoow
meoow / ffgif.py
Created Apr 10, 2018
Python wrapper of ffmpeg for creating high quality GIF from video clip
View ffgif.py
#!/usr/bin/env python2.7
import subprocess as subp
import tempfile
import os,os.path
import sys
def ffgif(input, output, fps=None, start=None, end=None, resize=None,ffmpeg_args=[]):
pipeyuvArgList = ['ffmpeg', '-loglevel', 'error', '-ss', start, '-i', input]
@meoow
meoow / dmg2iso.sh
Created Aug 4, 2014
Convert DMG to ISO format (using expect and mkisofs)
View dmg2iso.sh
#!/bin/bash
#export IFS=$'\n'
which -s mkisofs || {
echo can\'t not find mkisofs >&2
exit 1
}
path="$(dirname "$1")"
name="$(basename "$1")"
folder="${name%.[Dd][Mm][Gg]}"
cd "$path"
@meoow
meoow / aria2rpc.py
Created Aug 9, 2014
Aria2 RPC interface
View aria2rpc.py
#!/usr/bin/env python
import json, urllib2, sys, os
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('-c', '--cookie', help='use cookies', type=str,
default='', metavar='COOKIES', dest='cookies')
parser.add_argument('-o', '--output', help='output name', type=str,
default='', metavar='NAME', dest='output')
@meoow
meoow / g~f~w~list2pac.py
Last active Aug 1, 2016
After looking around for existed implementations for converting gfwlist to pac file, suprisingly few of them producing the results really statisfies me, so I eventually ended up writing an arguably better version for the task.
View g~f~w~list2pac.py
#!/usr/bin/env python2.7
# This script simply produces a working pac file,
# no fancy input arguments support yet.
# If someone is really interested in using this script,
# download the gfwlist.txt, decode it through base64, name it as "gfwlist_decoded.txt"
# and put it in the same direcotry with this script
# run the script in terminal.
import re
@meoow
meoow / shExpMatch.js
Last active Jul 25, 2016
This is the shExpMatch function for autoconfig pac. Normally the host machine that supports pac should have shExpMatch function built-in, but a piece of software I use reads pac file with lack of implementing this function, I ended up implemented by myself.
View shExpMatch.js
function shExpMatch(url, pat) {
var pcharcode0;
var ucharcode0;
var pcharcode1;
if (pat.length === 0) {
if (url.length === 0) {
return true;
} else {
@meoow
meoow / updateHost.py
Created Aug 4, 2014
Update/delete entries in system hosts file by a hosts file or URL
View updateHost.py
#!/usr/bin/env python2.7
import re
import os, os.path
import sys
import urllib2
from contextlib import closing
USAGE = "{0} hosts".format(sys.argv[0])
@meoow
meoow / vdmounter.sh
Created Aug 4, 2014
Mount VDI/VHD/VMDK images without virtual machine installed (need vdfuse)
View vdmounter.sh
#!/bin/bash
if ! which vdfuse &>/dev/null;then
echo Can not find vdfuse >&2
exit 1
fi
if [[ ! -f "$1" ]];then
echo Disk file does not exist >&2
exit 1
@meoow
meoow / block.txt
Last active Aug 29, 2015
Personal element hide
View block.txt
[Adblock Plus 2.0]
www.cnbeta.com##.wrapper.global_head > .tiny_bar > .cb_rss
www.safaribooksonline.com###js-subscribe-nag.subscribe-nag.clearfix.trial-panel.collapsed.slideUp
hi.baidu.com##.mod-page-body > .mod-page-main.wordwrap.clearfix > .x-page-container > .mod-blogpage-wraper > .grid-80.mod-blogpage > .mod-text-content.mod-post-content.mod-cs-contentblock > .mod-post-info.clearfix > .op-box.mod-cs-opBox > .pv
www.mtime.com###carter > embed
qun.qzone.qq.com##.td_upload_counts
www.talkshowcn.com###wideRight.col-md-4.column
||cnzz.com/stat.php
||cpro.baidustatic.com
You can’t perform that action at this time.