Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
x=''
for arg in "$@"
do
if [ ''$x = '' ]; then
x=' '
else
x=$x' '$arg
fi
done
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@zhuth
zhuth / crop.py
Last active August 29, 2015 14:04
#!/usr/bin/python
import os
from PIL import Image
fmt = '.tiff'
bias = 0
p = './'
a = os.listdir(p)
@zhuth
zhuth / pinyin.py
Created October 17, 2014 06:44
获取拼音缩写
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def multi_get_letter(str_input):
return_list = []
for one_unicode in str_input:
return_list.append(single_get_first(one_unicode))
return return_list
def single_get_first(unicode1):
#str1 = unicode1
#!/usr/bin/python
#coding: utf-8
globals = {}
exec_snippet_counter = 0
def exec_snippet(ll):
global globals, exec_snippet_counter
x = ''
exec_snippet_counter += 1
@zhuth
zhuth / 2013-Shanghai-AQIDailyReport.txt
Created November 21, 2014 08:26
2013-Shanghai-AQIDailyReport
2013/1/1 AQI为105,空气质量等级为三级,空气质量状况为轻度污染,首要污染物为PM2.5。其中各指标的分指数(IAQI)分别为:PM2.5为105,O3-8小时为23,CO为30,PM10为86,SO2为48,NO2为100
2013/1/2 AQI为76,空气质量等级为二级,空气质量状况为良,首要污染物为PM10。其中各指标的分指数(IAQI)分别为:PM2.5为70,O3-8小时为35,CO为20,PM10为76,SO2为26,NO2为55
2013/1/3 AQI为53,空气质量等级为二级,空气质量状况为良,首要污染物为PM2.5。其中各指标的分指数(IAQI)分别为:PM2.5为53,O3-8小时为26,CO为17,PM10为48,SO2为25,NO2为47
2013/1/4 AQI为62,空气质量等级为二级,空气质量状况为良,首要污染物为NO2。其中各指标的分指数(IAQI)分别为:PM2.5为59,O3-8小时为24,CO为21,PM10为49,SO2为22,NO2为62
2013/1/5 AQI为62,空气质量等级为二级,空气质量状况为良,首要污染物为NO2。其中各指标的分指数(IAQI)分别为:PM2.5为59,O3-8小时为23,CO为20,PM10为41,SO2为19,NO2为62
2013/1/6 N/A
2013/1/7 AQI为170,空气质量等级为四级,空气质量状况为中度污染,首要污染物为PM2.5。其中各指标的分指数(IAQI)分别为:PM2.5为170,O3-8小时为11,CO为34,PM10为88,SO2为51,NO2为97
2013/1/8 AQI为137,空气质量等级为三级,空气质量状况为轻度污染,首要污染物为PM2.5。其中各指标的分指数(IAQI)分别为:PM2.5为137,O3-8小时为29,CO为29,PM10为75,SO2为48,NO2为84
2013/1/9 AQI为124,空气质量等级为三级,空气质量状况为轻度污染,首要污染物为PM2.5。其中各指标的分指数(IAQI)分别为:PM2.5为124,O3-8小时为27,CO为29,PM10为79,SO2为52,NO2为67
2013/1/10 AQI为78,空气质量等级为二级,空气质量状况为良,首要污染物为NO2。其中各指标的分指数(IAQI)分别为:PM2.5为70,O3-8小时为26,CO为19,P
@zhuth
zhuth / npfft.py
Created February 23, 2015 07:05
wave file fft
#!/usr/bin/python
import wave
import numpy as np
import math
def dofft(filename, wlen = 16, sz = 44100):
wlen = wlen * sz / 1000
print 'wlen:', wlen
wr = wave.open(filename, 'r')
@zhuth
zhuth / ssreaderlink.js
Last active August 29, 2015 14:20
ssreader link getter (works with TemperMonkey)
@zhuth
zhuth / readnsdata.py
Created June 10, 2015 13:08
read ns plist data from python
#!/usr/bin/python
#coding: utf-8
import sys, os, biplist as bp
if len(sys.argv) > 1:
fs = [sys.argv[1]]
else:
fs = os.listdir('.')
for f in fs:
try:
@zhuth
zhuth / filelist.py
Created June 10, 2015 13:08
list duplicated files
#!/usr/bin/python
#coding: utf-8
import os, sys
import hashlib
path = sys.argv[1]
visited = set([])
if len(sys.argv) > 2:
for _ in open(sys.argv[2], 'r').readlines():