This file contains hidden or 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 | |
## Helpers | |
def get_word(words) | |
words.sample | |
end | |
def get_sentence(words) | |
count = (10..16).to_a.sample | |
str = "" | |
(0..count).each do |
This file contains hidden or 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
--[[ | |
By: skylarsch | |
Usage: branch <number of tunnels (8)> <length of each tunnel (10)> <space between tunnels (2)> | |
Each of the arguments are optional, but if you must specify all the values before the one you want to change. | |
--]] | |
-- MARK: Helper Functions | |
function fwd() -- Move forward | |
while not turtle.forward() do |
This file contains hidden or 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
--[[ | |
By: skylarsch | |
Usage: room <length (9)> <width (9)> <height (5)> | |
Each of the arguments are optional, but if you must specify all the values before the one you want to change. | |
--]] | |
-- MARK: Helper Functions | |
function fwd() -- Move forward | |
while not turtle.forward() do |
This file contains hidden or 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
enum FloatToDate { | |
case Second(Double) | |
case Minute(Double) | |
case Hour(Double) | |
case Day(Double) | |
case Week(Double) | |
case Month(Double) | |
case Year(Double) | |
func ago() -> NSDate { |
This file contains hidden or 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 | |
### | |
# | |
# : Usage | |
# ./start -j server.jar -m 2G | |
# -j ) Path to the jar file | |
# -m ) Amount of memory to give the Java process | |
# | |
### |
This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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); | |
} |