Skip to content

Instantly share code, notes, and snippets.

@agassiyzh
agassiyzh / UIImage+CutSize.h
Created November 9, 2011 21:16
UIImage切图
@interface UIImage (CutSize)
- (UIImage*)cutToSize:(CGSize)size;
@end
@agassiyzh
agassiyzh / info.yuzhuohui.sshd.plist
Created November 17, 2011 23:55
mac 开启自动连ssh
<?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>Label</key>
<string>info.yuzhuohui.sshd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/autossh</string>
<string>-M</string>
@implementation UIImage (TPAdditions)
-(id)initWithContentsOfResolutionIndependentFile:(NSString*)path {
if([[[UIDevice currentDevice] systemVersion] intValue] >=4&&[[UIScreen mainScreen] scale]==2.0){
NSString*path2x =[[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@@2x.%@", [[path lastPathComponent] stringByDeletingPathExtension], [path pathExtension]]];
if([[NSFileManager defaultManager] fileExistsAtPath:path2x]){
return[self initWithCGImage:[[UIImage imageWithData:[NSData dataWithContentsOfFile:path2x]] CGImage] scale:2.0 orientation:UIImageOrientationUp];
}
}
@agassiyzh
agassiyzh / noatime.plist
Created December 19, 2011 03:44
mac noatime 配置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>noatime</string>
<key>ProgramArguments</key>
<array>
<string>mount</string>
@agassiyzh
agassiyzh / git-version.sh
Created March 30, 2012 10:20
xcode在编译时带上git版本信息
git_version=`git rev-parse --short HEAD`
app_version=`git describe --tags`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $app_version" $PRODUCT_SETTINGS_PATH
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $git_version" $PRODUCT_SETTINGS_PATH
@agassiyzh
agassiyzh / GetDoubanAlbum.py
Created August 12, 2012 08:23
豆瓣相册下载脚本
'''
Created on Aug 7, 2011
@author: Agassi
'''
#_*_encoding:utf-8_*_
@agassiyzh
agassiyzh / info.yuzhuohui.shadowsocks.plist
Created February 23, 2013 18:57
launch shadowsocks plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>info.yuzhuohui.shadowsocks</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/node</string>
<string>/var/shadowsocks-nodejs/local.js</string>
@agassiyzh
agassiyzh / leech-tr
Created September 24, 2013 06:30
transmission RSS on My book live
#!/bin/sh
# Modified: YZH <[email protected]>
USAGE(){
echo "Options:
-d: Specify the torrent files directory
-f: Specify a feeds list file to download from
-k: Specify keywords to filter RSS (AND [+] OR[SPACE , ;])
-m: Specify max task one time (Default: 5)"
}
#! /bin/sh
### BEGIN INIT INFO
# Provides: transmission-daemon
# Required-Start: networking
# Required-Stop: networking
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Start the transmission BitTorrent daemon client.
### END INIT INFO
@agassiyzh
agassiyzh / auto_rename.sh
Last active December 23, 2015 23:59
Put transmission torrent to current place
#!/bin/bash
HOST=localhost
PORT=9091
RPC_AUTH=0
USER=username
PASS=password
############################################################################