Navigation Menu

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 / 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 / bashrc
Last active March 6, 2021 02:22
append / prepend / remove path from PATH
addpath() { #{{{
local method path
if (($#==0));then
cat <<_EOF_
addpath [+|_|-] path [... pathN]
+ append path (default)
- remove path
_ prepend path
_EOF_
@meoow
meoow / aria2rpc.py
Created August 9, 2014 11:56
Aria2 RPC interface
#!/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 / downxnviewmp.sh
Created August 9, 2014 11:54
Download XnView MP
#!/bin/bash
ver=$(curl -s -L http://www.xnview.com/en/xnviewmp/|sed -n -E '/Version/{s/.*Version ([\.0-9]+).*/\1/;s/\.//;p;q;}')
header='http://download.xnview.com/XnViewMP-'
files=(
win.exe
win-x64.exe
mac.tgz
@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
@meoow
meoow / colfilter.py
Created August 9, 2014 11:48
Filtering One File by Another File
#!/usr/bin/env python2.7
from argparse import ArgumentParser
import sys
def parseArg():
'''parse command line arguments'''
parser = ArgumentParser()
parser.add_argument('-i', '--input', dest='input', metavar='INPUT',\
type=file, default=sys.stdin, help='Full input file')
@meoow
meoow / utoa.pl
Created August 9, 2014 11:46
Convert Unicode Characters to ASCIIs
#!/usr/bin/env perl -i -n
use warnings;
use strict;
use Encode;
my $l=decode_utf8($_);
$l=~s/([^[:ascii:]])/"&#".ord($1).";"/ge;
print $l;
@meoow
meoow / text2pic.py
Created August 9, 2014 11:44
Convert Text to Image
#!/usr/bin/env python2.7
# coding:utf-8
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
import sys
import re
fontSize = 18
@meoow
meoow / list.txt
Created August 9, 2014 11:43
Blocking Dopus Online Validation
ver2.gpsoft.com.au
ver0.gpsoft.com.au
blog.dopus.com
www.gpsoft.com.au
dns.msftncsi.com