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 | |
n1=${1:?} | |
n2=${2:?} | |
n3=${3:?} | |
if [ $n1 > $n2 ];then | |
tmp=$n1 | |
n1=$n2 | |
n2=$tmp | |
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
/** | |
* FizzBuzz | |
*/ | |
public class FizzBuzz { | |
final String F = "Fizz"; | |
final String B = "Buzz"; | |
public void fizzBuzz(int number) { | |
for (int i = 1; i < number + 1; i++) { | |
boolean fizz = (i % 3 == 0); | |
boolean buzz = (i % 5 == 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
let fizz = "Fizz" | |
let buzz = "Buzz" | |
func getGenerator(num: Int, out:String) -> (Int -> String) { | |
func getStr(targetNum:Int) -> String { | |
if targetNum % num == 0 { | |
return out | |
} else { | |
return "" | |
} |
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
UITableView *view = [[UITableView alloc] init]; | |
view.tag = 1; | |
[superView addSubview: view]; | |
UIView *subView = [superView viewWithTag: 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
. | |
├── batch | |
│ └── BatchConfiguration.java | |
└── hello | |
├── Application.java (main) | |
├── Person.java | |
└── PersonItemProcessor.java |
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
class LLNode<T> { | |
var key: T? = nil | |
var next: LLNode? = nil | |
var prev: LLNode? = nil | |
init() { | |
} | |
init(PREV prev:LLNode!, KEY key:T!, NEXT next:LLNode!) { | |
self.prev = prev | |
self.key = key | |
self.next = next |
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
func applyKTimes<T>(f:(T) -> T, x:T, k:Int) -> T { | |
return k > 0 ? f(applyKTimes(f, x, k - 1)) : x | |
} | |
struct User { | |
var name:String? | |
var age:Int? | |
init(name:String?, age:Int?) { | |
self.name = name | |
self.age = age |
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
$ ./wifilog.sh | |
[2014/11/30 20:59:36]: 308 GB |
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
#define ZERO 0 | |
#define ONE 1 | |
#define A "a" | |
NSLog(@"ONE = %d", ONE); | |
NSArray *array = [NSArray arrayWithObjects:ZERO, ONE, A, nil]; | |
NSLog(@"array.count = %d", array.count); | |
NSLog(@"array = %@", array); | |
array = [NSArray arrayWithObjects:@"0", @"1", nil]; | |
NSLog(@"array.count = %d", array.count); | |
NSLog(@"array = %@", 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
#!/bin/bash | |
URL="http://pocketwifi.home/api/monitoring/traffic-statistics" | |
response=`curl -s $URL` | |
PATTERN=TotalDownload | |
downloadByte=`echo "$response" \ | |
| grep $PATTERN \ | |
| sed -e "s/<TotalDownload>//g" -e "s~</TotalDownload>~~g"` | |
if [ ! $downloadByte ];then | |
exit 1; | |
fi |
OlderNewer