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
#include <stdio.h> | |
static int num_ten[] = { | |
1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 100000000 | |
}; | |
int get_num(n, s, e) { | |
int d = num_ten[9 - e]; | |
int r = num_ten[e - s + 1]; | |
return n / d % r; |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
char *replace(char *dst, const char *src, const char *rep_from, const char *rep_by) | |
{ | |
//*dst = 0; | |
const char *start = src; | |
char *end; | |
size_t len = strlen(rep_from); |
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
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <ctype.h> | |
#include <fcntl.h> | |
#include <stddef.h> | |
#include <stdarg.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <malloc.h> | |
#include <errno.h> |
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
#include <string.h> | |
#include <stdio.h> | |
typedef enum live { | |
placeholder, | |
oldman, | |
dog, | |
husband, | |
wife, | |
boy, |
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
#include <stdio.h> | |
#include <string.h> | |
void write_value(char *c, int value, int head, int tail, int len) | |
{ | |
int high = value >> 8; | |
int low = (1 << 8) - 1 & value; | |
if (len == 1) { | |
c[0] = low | head; | |
} |
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 groovy.transform.Field; | |
@Field x = 1..5 | |
def hello(obj) { | |
groovy_lang() | |
println "what the fuck $obj.a, $obj.b, $obj.c, $x.from, $x.to" | |
} | |
def groovy_lang() { |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
struct tval { | |
int v; | |
int i; | |
}; | |
struct minstack { |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define MAGIC_TAG 0x11223344 | |
inline static void* my_malloc(int size) { | |
void* ptr = malloc(size + sizeof(MAGIC_TAG)); | |
int *p = (int *) ptr; | |
*p = MAGIC_TAG; |
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
local function gen() | |
local arr = {} | |
for i = 1, 9 * 9 do | |
arr[i] = i > 25 and 0 or i | |
end | |
return arr | |
end | |
local function pr(arr) | |
local r = {} |
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
export interface TimerObj { | |
id : number; | |
func : (...params) => void; | |
interval : number; | |
loop : number; | |
forever : boolean; | |
params : Array<any>; | |
count : number; | |
finished : boolean; | |
call_time : number; |
OlderNewer