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 PollerEnum { | |
Item(()), | |
Timer, | |
} | |
struct Poller { | |
timer: Interval, | |
inner_iter: Option<Box<futures::stream::IterOk<std::vec::IntoIter<()>, std::io::Error>>>, | |
} |
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
mingw32-gcc select_ws.c -Wl,-lws2_32 -g -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wundef -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wno-sign-conversion -Wvla -Wno-pedantic-ms-format -Wno-system-headers -o select_ws.exe |
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
/* (c) kristopher tate ; all rights resevered. */ | |
static uint16_t eoc_encode(uint16_t code, uint8_t start, uint8_t binrep[ROUTE_LENGTH]) | |
{ | |
int i; | |
int pos = 0; | |
uint8_t bits[4]; | |
while (code > 1) { | |
int len = 0; | |
for (int temp = code; temp > 0; temp >>= 1) { /*calculate 1+floor(log2(num))*/ | |
len++; |
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
/* | |
* How to use std::map instead of NSMapTable -- assuming ARC | |
* Objective-C++はクレージーしすぎる件w まあいいか。 | |
* License: Public-Domain | |
*/ | |
#ifdef __cplusplus | |
#include <map> | |
#endif |
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
//A note on how to work with ARC, Objective-C blocks and C libraries. | |
//with love from kristopher on a Sunday (2013.2.3@5:46a JST) | |
//License: Public-Domain | |
//あるLibraryのAsync Callback TypeDef | |
typedef void (somelibrary_doasync_cb)(int state, uintptr_t user_data); | |
//あるLibraryのAsync Function | |
void somelibrary_doasync(somelibrary_doasync_cb callback, uintptr_t user_data); | |
//われわれのBlockDef | |
typedef void (^StatusHandlerBlock)(int state); |
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
''' | |
* input_to_array.py | |
(c) 2013 kristopher tate -- http://kristopher.jp | |
* read a file and dump it as an array of characters for easy embedding | |
* couldn't find something similar so I wrote this -- may it also be useful to you! | |
* MIT License | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to |
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
NSString* fname = [target lastPathComponent]; | |
NSString* fnameNoExt = [fname stringByDeletingPathExtension]; | |
NSString* extension = [fname pathExtension]; | |
int fileIndex = 1; | |
while ([[NSFileManager defaultManager] fileExistsAtPath: [folder stringByAppendingPathComponent:fname]]) | |
{ | |
//NSLog(@"FNAME : %@",fname); | |
fname = [NSString stringWithFormat:@"%@ (%d).%@", fnameNoExt, fileIndex, extension]; | |
//NSLog(@"Setting filename to :: %@",fname); |
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
kristate@www12294uf:~$ gcc test1.c; ./a.out | |
type_a: 1.900000 seconds | |
type_b: 1.420000 seconds | |
kristate@www12294uf:~$ gcc test1.c; ./a.out | |
type_a: 1.790000 seconds | |
type_b: 1.430000 seconds | |
kristate@www12294uf:~$ gcc test1.c; ./a.out | |
type_a: 1.480000 seconds | |
type_b: 1.480000 seconds | |
kristate@www12294uf:~$ gcc test1.c; ./a.out |