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> | |
static unsigned long crypt[0x500]; | |
void crypt_init(); | |
#define PRIME_SIZE 32 | |
static const unsigned long prime_list[PRIME_SIZE] = | |
{ | |
0ul, 3ul, 11ul, 23ul, 53ul, |
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
void file_copy(const char * dest, const char* src) | |
{ | |
FILE * fsrc = fopen(src,"rb"); | |
FILE * fdest = fopen(dest,"wb"); | |
fseek(fsrc,0L,SEEK_END); | |
long sz = ftell(fsrc); | |
rewind(fsrc); | |
unsigned char * buff = (unsigned char *)malloc(sizeof(unsigned char) * sz); | |
fread(buff,sz,sizeof(unsigned char),fsrc); | |
fwrite(buff,sz,sizeof(unsigned char),fdest); |
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
package com.argcv.util; | |
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.io.IOException; | |
public class CSVParser { | |
final static int defaultMaxWidth = 20; |
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
/** | |
* MappingDict.cc | |
* | |
* Created on: May 28, 2013 | |
* Author: zhangjing0544 | |
*/ | |
#include "MappingDict.h" | |
int MappingDict::GetId(const string& key) |
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> // for system xxx | |
#include <string.h> | |
#include <sys/stat.h> // for int mkdir(const char *path, mode_t mode); | |
#define MATCH(a,b) (strcmp(a,b) == 0) | |
void fdel(const char * name); | |
void fadd(const char * name); |
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 <cstdio> | |
class MyClass | |
{ | |
public : | |
MyClass() | |
{ | |
printf("my class inited\n"); | |
} | |
~MyClass() |
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 <windows.h> | |
int main() | |
{ | |
//获取进程ID,因为你希望是多个进程运行同时写一个文件,所以,我们打印出进程ID | |
DWORD dwProcessID = GetCurrentProcessId(); | |
//初始化我们要写入文件中的内容,及该内容长度; | |
//为了让每次写入内容变化,此处只声明,需要时候再写。 |
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/sh | |
DIR_LIST=`cat filelist` | |
EXC_PATTERN=`cat exclude` | |
tar -czvf .bak.src.`date "+%Y%m%d%H%M%S"`.tar.gz $DIR_LIST | |
rsync -avh --progress --exclude=$EXC_PATTERN [email protected]:xdatacenter_load/ proj/ |
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
package util; | |
import java.util.ArrayList; | |
import java.util.List; | |
public abstract class MinHeap<T> { | |
private int sizeLimit; | |
private int size; | |
private List<T> heap; |
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
float f_sqrt(float x) | |
{ | |
float xhalf = 0.5f*x; | |
int i = *(int*)&x; // get bits for floating VALUE | |
i = 0x5f375a86- (i>>1); // gives initial guess y0 | |
x = *(float*)&i; // convert bits BACK to float | |
x = x*(1.5f-xhalf*x*x); // Newton step, repeating increases accuracy | |
x = x*(1.5f-xhalf*x*x); // Newton step, repeating increases accuracy | |
x = x*(1.5f-xhalf*x*x); // Newton step, repeating increases accuracy | |
return 1/x; |