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
# Add this script to root's cron | |
# Do it every sunday. | |
# 0 0 * * 0 /path/to/logroll.sh | |
function roll_log { | |
if [ $(ls -s $1 | cut -d' ' -f1) -gt '10240' ]; then | |
ts=$(date +%s) | |
mv $1 ${1}.$ts | |
if [ $? -ne 0 ];then | |
exit 1 | |
fi |
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/sh | |
# Change this line to the URI path of the xcode DMG file. | |
# XCode 3.2.5 | |
#XCODE_PATH="/ios/ios_sdk_4.2__final/xcode_3.2.5_and_ios_sdk_4.2_final.dmg" | |
# XCode 4 | |
#XCODE_PATH="/Developer_Tools/xcode_4_and_ios_sdk_4.3__final/xcode_4_and_ios_sdk_4.3__final.dmg" |
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 | |
for pack_name in $(ls $(brew --prefix)/Cellar);do | |
brew cleanup $pack_name 2> /dev/null | |
done |
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/sh | |
myscript_dir=/usr/local/bin/myscripts | |
if [ $# -lt 1 ]; then | |
echo "Usage: $(basename $0) command_name [options]" | |
echo "Help: " | |
echo "\t list (l) -- show all available commands" | |
echo "\t - ll -- show all available commands, long format" | |
echo "\t - la -- show all available commands, full format" |
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 'open-uri' | |
if ["--help", "help", "-h"].include?(ARGV[0]) || ARGV.size < 1 | |
puts "Usage: #{File.basename __FILE__} ( 720p | 540p | 540i | 360p | 360i | 360is | 224p )" | |
exit 0 | |
end | |
size_hash = {"720p" => "4540", "540p" => "2540", "540i" => "1840", "360p" => "1240", "360i" => "0640", "360is" => "0440", "224p" => "0240"} | |
video_size = size_hash[ARGV[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
#!/usr/bin/env ruby | |
require "sqlite3" | |
dbfile = "data.sqlite3" | |
File.unlink dbfile if File.exists? dbfile | |
db = SQLite3::Database.new dbfile | |
db.execute("create table `entries` (id integer primary key autoincrement, question string, choice1 string, choice2 string, answer string);") | |
infile = open "dd.txt", 'r' |
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
#import "Fanfou_For_MacAppDelegate.h" | |
#import <Webkit/WebKit.h> | |
@implementation Fanfou_For_MacAppDelegate | |
@synthesize window; | |
@synthesize webView; | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ |
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 | |
# | |
# Now you can fire up the command like this: | |
# ./rename.rb New.Riders.Flexible.Web.Design.Dec.2008.rar Flexible Web Design | |
# | |
# if there's any special characters in the REAL file name, | |
# escape them to prevent the shell to parse it. |
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
American Typewriter: | |
AmericanTypewriter | |
AmericanTypewriter-Bold | |
Apple Color Emoji: | |
AppleColorEmoji | |
AppleGothic: | |
AppleGothic |
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" | |
(puts "Usage: #{File.basename $0} widthxheight"; exit 0) if ARGV.size != 1 | |
width, height = ARGV[0].split("x").collect(&:to_i) | |
(puts "Please enter a valid size."; exit 0) if ((width.to_i == 0) or (height.to_i == 0)) | |
half_width = width / 2 | |
FileUtils.cd("images") do | |
Dir['**/*'].each do |f| |