This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Constants | |
TMPDIR=/tmp/apod | |
LISTFILE=$TMPDIR/list.html | |
REMOTEPREFIX=http://antwrp.gsfc.nasa.gov/apod/ | |
# Functions | |
function parse_page() { | |
printf "Downloading photo page %s...\n" $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
#encoding=utf8 | |
cities = {} | |
open("/Users/venj/Desktop/city.txt").each_line do |l| | |
city = l.split("=").last | |
if cities[city].nil? | |
cities[city] = 0 | |
else | |
cities[city] += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
Dir["*.f4v"].each do |file| | |
name = File.basename file, ".f4v" | |
system("ffmpeg -i '#{file}' -acodec copy -vcodec copy '#{name}.m4v'") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# colors.sh - Print out all the different ECMA color-mod combos | |
# | |
# 2008 - Mike Golvach - [email protected] | |
# | |
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License | |
# | |
declare -a color_array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Remux MP4/H264 videos (mkv, avi, etc.) to m4v. | |
TMPFILE = "/tmp/ffprobe_out.txt" | |
VIDEO_CONTAINER = ["mkv", "f4v", "avi", "divx", "ts"] | |
VCODECS = ["mpeg4", "h264"] | |
ACODECS = ["aac"] | |
if (`which ffmpeg` == "") | |
puts "You need ffmpeg to use this command." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "fileutils" | |
include FileUtils | |
p = "processed" | |
mkdir "processed" unless File.exists?(p) | |
Dir["*.png"].each do |f| | |
puts "Processing #{f}." | |
name = File.basename(f).split('.')[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Attribute VB_Name = "包合常数自动计算脚本" | |
' | |
' 作者: venj | |
' 日期: 2007年01月06日 | |
' 版本: 0.2.0 Update 1 | |
' | |
' 用途: 环糊精包合常数自动计算脚本 | |
' | |
' ChangeLog: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>OnDemand</key> | |
<false/> | |
<key>KeepAlive</key> | |
<true/> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
TARGET_WIDTH = 1000.0 | |
Dir["*.jpg"].each do |f| | |
fileinfo = `convert #{f} -print "%wx%h" /dev/null` | |
width, height = fileinfo.split("x").collect(&:to_i) | |
height *= (TARGET_WIDTH / width) | |
width = TARGET_WIDTH | |
print "Processing #{f}..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
用iOS 5的GeoCoder API,反向解析经纬度。代码简略如下: | |
*/ | |
CGFloat lat = 30.0; CGFloat lng = 120.0; | |
CLGeocoder *coder = [[CLGeocoder alloc] init]; | |
CLLocation *mapLocation = [[CLLocation alloc] initWithLatitude:lat longitude:lng]; | |
[coder reverseGeocodeLocation:mapLocation completionHandler:^(NSArray *placemarks, NSError *error) { |