Skip to content

Instantly share code, notes, and snippets.

@neojou
neojou / Makefile
Last active January 1, 2016 12:49
Makefile example
CC = gcc
CFLAGS = -Wall -Werror -fconstant-string-class=NSConstantString -D_NATIVE_OBJC_EXCEPTIONS
INCDIR = -I `gnustep-config --variable=GNUSTEP_SYSTEM_HEADERS`
LIBDIR = -L `gnustep-config --variable=GNUSTEP_SYSTEM_LIBRARIES`
OBJS = helloworld.o
LIBS = -lobjc -lgnustep-base
.SUFFIXS: .c .cpp .m
helloworld: ${OBJS}
${CC} ${OBJS} ${LDFLAGS} ${LIBS} -o $@
{
"pools" : [
{
"url" : "stratum+tcp://hostname:port",
"user" : "username",
"pass" : "password"
}
],
@neojou
neojou / miner.sh
Created December 27, 2013 17:28
cgminer shell script
#!/bin/sh
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
./cgminer -c miner.conf
NSData *data = [ @"Happy New Year" dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString * encoded = [[NSString alloc] initWithData:[GTMBase64 encodeData:data] encoding:NSASCIIStringEncoding];
NSLog( @" encoded:%@ " , encoded);
NSString * decoded = [[NSString alloc] initWithData:[GTMBase64 decodeString:encoded] encoding:NSASCIIStringEncoding];
NSLog( @" decoded:%@ " , decoded);
@neojou
neojou / HelloWorldViewController.h
Last active January 2, 2016 22:09
iphone hello world
#import <UIKit/UIKit.h>
@interface HelloWorldViewController : UIViewController <UITextFieldDelegate>
@property (copy, nonatomic) NSString *userName;
@end
@neojou
neojou / helloworld.m
Created February 4, 2014 14:51
Objective-c helloworld
#import <Foundation/Foundation.h>
int main(void)
{
NSLog(@"Hello, World!");
return 0;
}
@neojou
neojou / gist:8913103
Created February 10, 2014 09:45
Python 裝飾器 @
import time
def timeusage(func):
def call(*args, **kwargs):
start = time.clock()
print func(*args, **kwargs)
end = time.clock()
return "Time costs : %s . " % (end - start )
return call
@neojou
neojou / fabonacci.py
Last active August 29, 2015 13:56
python iterator yield - fabonacci numbers list
def fab(max):
n, a, b = 0, 0, 1
while n < max :
yield b
a, b = b, a+b
n = n+1
for v in fab(5):
print(v)
@neojou
neojou / helloworld.php
Created April 19, 2014 03:02
PHP helloworld
<?php
header("Content-Type:text/html; charset=utf-8");
echo "Hollo world!";
?>
@neojou
neojou / functest1.php
Created April 19, 2014 07:42
PHP function test
<?php
function showName()
{
return 'PHP';
}
header("Content-Type:text/html; charset=utf-8");
echo 'The script language is ' . showName() . '!';
?>