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
alias minecraft='ssh -t username@domain.com "screen -dR"' |
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
- (NSString *)urlEncodeStringUsingEncoding:(NSStringEncoding)encoding { | |
return (__bridge NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)self, NULL, (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ", CFStringConvertNSStringEncodingToEncoding(encoding)); | |
} |
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
+ (UIImage *)imageFromGifData:(NSData *)data { | |
CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFTypeRef)data, NULL); | |
if (!source) { | |
return nil; | |
} | |
CFDictionaryRef dict = CGImageSourceCopyPropertiesAtIndex(source, 0, NULL); | |
NSDictionary *metadata = (__bridge NSDictionary *)dict; | |
CGFloat offset = 0.0; | |
if (metadata[@"{GIF}"]) { | |
NSDictionary *meta = metadata[@"{GIF}"]; |
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 | |
### | |
## A simple bash script for starting a minecraft server | |
## | |
## Options: | |
## -g : Sets the game mode. 0|1 (default 0) | |
## -m : Sets the amount of memory to start with. (default 756) | |
## -t : Sets the memory type. (default M) | |
## |
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
echo "Bumping build number..." | |
plist=${PROJECT_DIR}/${INFOPLIST_FILE} | |
# increment the build number (ie 115 to 116) | |
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}") | |
if [[ "${buildnum}" == "" ]]; then | |
echo "No build number in $plist" | |
exit 2 | |
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
#import <objc/runtime.h> | |
NS_INLINE void xx_MethodSwizzle(Class c, SEL origSEL, SEL overrideSEL) { | |
Method origMethod = class_getInstanceMethod(c, origSEL); | |
Method overrideMethod = class_getInstanceMethod(c, overrideSEL); | |
if(class_addMethod(c, origSEL, method_getImplementation(overrideMethod), method_getTypeEncoding(overrideMethod))) { | |
class_replaceMethod(c, overrideSEL, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); | |
} else { | |
method_exchangeImplementations(origMethod, overrideMethod); | |
} |
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 <UIKit/UIKit.h> | |
@interface DrawView : UIView | |
@property (nonatomic) CGMutablePathRef drawingPath; | |
@property (nonatomic) CGPoint lastPoint; | |
@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
@interface View : UIView | |
@property (nonatomic, weak) UIView *mySubview; | |
@end | |
@implementation View | |
- (UIView *)mySubview { | |
if (!_mySubview) { |
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
screen -R MC -X stuff "say Performing backup $(printf '\r')" | |
screen -R MC -X stuff "save-off $(printf '\r')" | |
screen -R MC -X stuff "save-all $(printf '\r')" | |
sleep 3 | |
# Backup | |
cd /<path to backups folder> | |
# Delete file older than 5 days |
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 | |
# The name of the .jar file for the latest version. | |
MINECRAFT_LATEST="minecraft_server.1.7.9.jar" | |
# The URL for the lates version of the minecraft server | |
MINECRAFT_LATEST_LINK="https://s3.amazonaws.com/Minecraft.Download/versions/1.7.9/minecraft_server.1.7.9.jar" | |
# The screen name for the Minecraft Server | |
MINECRAFT_SCREEN_NAME="Minecraft" | |
# Setup some variables |
OlderNewer