Skip to content

Instantly share code, notes, and snippets.

View meoow's full-sized avatar

Ang Li meoow

  • Beijing University
  • homeless
View GitHub Profile
@meoow
meoow / ffaac.py
Created October 24, 2014 07:05
Convert all FFmpeg supported media file to high quality AAC file (need libfdk_aac encoder)
#!/usr/bin/env python2.7
from optparse import OptionParser
from subprocess import call
from os.path import splitext
import sys, os
def ffaac(filename, opts):
cmd = ['ffmpeg', '-hide_banner', '-y', '-i', filename,
'-c:a', 'libfdk_aac']
@meoow
meoow / blockit.sh
Created October 24, 2014 07:24
A simple way for blocking apps to connect to internet.
#!/bin/bash
# Usage:
# navigate the MacOS folder inside the app bundle you want to block
# usually where it is "SomeApp.app/Contents/MacOS"
# open terminal at current location
# run "blockit.sh executable"
# note the name "executable varies per apps"
# then this app is no longer be able to connect to internet.
if [[ -z "$1" ]];then
@meoow
meoow / cpv.sh
Last active August 29, 2015 14:05
Simple alternative for **cp** but shows progress
cpv() {
if ! type -P pv >/dev/null;then
echo need pv >&2
return 1
fi
case $# in
0|1)
echo invalid arguments >&2
return 1
;;
@meoow
meoow / add_disabled.py
Created August 14, 2014 03:26
Add disabled into plist file of iOS apps
#!/usr/bin/env python2.7
import plistlib as plib
import subprocess as subp
from contextlib import closing
import os, tempfile, shutil, re
from NameAppend import nameAppend
def parsePlistToString(plistFile=None):
'''parsePlistToString(plistFile)
@meoow
meoow / updatecookie.py
Created August 14, 2014 03:28
Update cookie for xunlei-lixian
#!/usr/bin/env python2.7
import os, sys
import ConfigParser as cfgp
import sqlite3 as sql
import cookielib
import pdb
def getDefaultProfile(profilesIniFile):
profilesCfg = cfgp.ConfigParser()
profilesCfg.read(profilesIniFile)
@meoow
meoow / xunlei-lixian-gui.py
Created August 14, 2014 03:32
Simple GUI for xunlei-lixian
#!/usr/bin/env python2.7
from PyQt4.QtCore import SIGNAL, pyqtSignal, QObject, QString
from PyQt4.QtGui import (QApplication, QDialog,
QTextBrowser, QPushButton, QVBoxLayout,
QLineEdit, QGridLayout, QTextCursor,
QLabel, QHBoxLayout, QFileDialog,
QCheckBox , QSizePolicy , QSpacerItem,
QGroupBox, QComboBox, QSpinBox)
import sys,os,re
import subprocess as subp
@meoow
meoow / screenshot.py
Created August 14, 2014 03:35
Take screenshot
import sys
from PyQt4.QtGui import QPixmap, QApplication
import os
namebase='screenshit_'
num=1
outdir= os.path.abspath(os.path.join(os.environ['HOMEPATH'],'Documents'))
while os.path.exists(os.path.join(outdir,namebase+str(num)+'.png')):
num+=1
fulloutname = os.path.join(outdir, namebase + str(num) + '.png')
@meoow
meoow / bashrc
Last active August 29, 2015 14:05
return absolute path in pure bash
#get absolute path(shell)
abspath(){ #{{{
local thePath
if [[ ! "$1" =~ ^/ ]];then
thePath="$PWD/$1"
else
thePath="$1"
fi
IFS=/ parr=($thePath)
declare -a outp
@meoow
meoow / extractflash.sh
Created August 9, 2014 11:51
Install Flash Broswer Plugin without Running the Installer (Spares Other Craps Being Foreced to be Installed)
#!/bin/bash
[[ ! -f "$1" ]] && exit 1
dmgfile="$1"
while read a b c;do
eval mp='$c'
done < <(hdiutil mount -noautofsck -noverify -noautoopen "$dmgfile"||exit 1)
echo Step 1
@meoow
meoow / zimbuild.sh
Created August 9, 2014 11:49
zimwriterfs shell wrapper
#!/bin/bash
# index icon dir file.zim
abspath(){ #{{{
local thePath
if [[ ! "$1" =~ ^/ ]];then
thePath="$PWD/$1"
else
thePath="$1"
fi