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
RM := rm -f | |
CXXFLAGS := -Wall | |
programs := run | |
.PHONY: all | |
all: $(programs) | |
$(programs): libhello.a |
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 | |
version=gtest-1.7.0 | |
root=/usr/local | |
sudo apt-get install cmake | |
wget https://googletest.googlecode.com/files/$version.zip -P ~ | |
(cd ~; unzip ${version}.zip;) |
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/sh | |
sleep 1 | |
cat |
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 | |
echo "---> sleep 0" | |
for loop in `seq 10`; do awk 'BEGIN{ srand(); print rand() }'; done | |
echo "---> sleep 0.5" | |
for loop in `seq 10`; do awk 'BEGIN{ srand(); print rand() }'; sleep 0.5; done | |
echo "---> sleep 1.0" | |
for loop in `seq 10`; do awk 'BEGIN{ srand(); print rand() }'; sleep 1.0; done | |
echo "---> srand(\$RANDOM)" | |
for loop in `seq 10`; do awk 'BEGIN{ srand('"$RANDOM"'); print rand() }'; done |
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
#include <stdio.h> | |
int | |
main(void) | |
{ | |
double answer = 0.1 + 0.1 + 0.1; | |
if(answer == 0.3){ | |
printf("True:%.100f\n", answer); | |
} else { |
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 | |
if [ $# -ne 2 ]; then | |
echo "$0 [the number of insert] [output file]" | |
exit 1 | |
fi | |
nmemb_insert=$1 | |
ddlfile=$2 | |
cat <<- EOF > $ddlfile |
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 | |
#log format:[log_msg time] | |
calc_avg(){ | |
awk 'BEGIN{ OFS="\t"; sum=0; max=0; } | |
NR==1 { min=$2; } | |
{ sum+=$2; if($2>max){max=$2}; if(min>$2){min=$2}; } | |
END{ print($1, sum, NR, max, min, sum/NR) }' | |
} |
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
awk 'BEGIN{ OFS="\t"; sum=0; max=0; } | |
NR==1 { min=$2; } | |
{ sum+=$2; if($2>max){max=$2}; if(min>$2){min=$2}; } | |
END{ print($1, sum, NR, max, min, sum/NR) }' |
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
#include <stdio.h> | |
#include <stdarg.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <time.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#define ERROR(fmt, ...) err_msg(__FILE__, __FUNCTION__, __LINE__, "error", fmt, ##__VA_ARGS__) | |
#define WARNNING(fmt, ...) err_msg(__FILE__, __FUNCTION__, __LINE__, "warnning", fmt, ##__VA_ARGS__) |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <time.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
void err_msg(const char *, const char *, int, const char *, const char *, ...); |
OlderNewer