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 <ctype.h> | |
#include <stdio.h> | |
int main(void) | |
{ | |
int ch; | |
while((ch = getchar()) != EOF) { | |
putchar(toupper(ch)); | |
} | |
return 0; |
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
int checkSymbol(Stack S){ | |
char ch; | |
while((ch = getchar()) != '#'){ | |
if(ch == '(' || ch == '[' || ch == '{'){ | |
Push(ch, S); | |
} | |
else if(ch == ')' || ch == ']' || ch == '}'){ | |
if(isEmpty(S)) | |
Error("Stack is empty"); | |
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
#include <stdio.h> | |
#define MAXNUM 100 // Count数组大小(M) | |
/* 功能:桶式排序 | |
* 输入: 待排序数组arrayForSort[] | |
* 待排序数组大小arraySize (N) | |
* 上界maxitem,元素都落在[0, maxitem] | |
* 输出 void | |
* 时间复杂度 O(M+N) | |
*/ |
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
import base64 | |
def xunlei_url_encode(url): | |
return 'thunder://'+base64.encodestring('AA'+url+'ZZ').replace('\n', '') | |
def xunlei_url_decode(url): | |
assert url.startswith('thunder://') | |
url = base64.decodestring(url[10:]) | |
assert url.startswith('AA') and url.endswith('ZZ') | |
return url[2:-2] |
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> | |
#define MAXSIZE 25 | |
#define OK 1 | |
#define ERROR 0 | |
typedef int Status; | |
typedef int SElemType; | |
typedef struct { | |
SElemType data[MAXSIZE]; |
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
mysqldump -u root -p linuxcast > linuxcast_backup.sql | |
mysql -u root -p linuxcast < linuxcast_backup.sql |
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) | |
{ | |
int a = 0x80000000; | |
printf("os is %d\t%d\n", a, sizeof(int)); | |
union ut { | |
short s; | |
char c[2]; | |
} u; |
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
void inplace_swap(int *x, int *y) | |
{ | |
*y = *x ^ *y; | |
*x = *x ^ *y; | |
*y = *x ^ *y; | |
} |
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 [ -z "$1" ] ; then | |
echo "$(basename "$0") kernel-ver" | |
exit 1 | |
fi | |
PACKAGES=(`dkms status | grep "$1" | awk -F ', ' '{ print $1"/"$2 }'`) |
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
from collections import Counter | |
num = "135481963636" | |
n = Counter(num) | |
for key, freq in n.most_common(): | |
print("{0}: {1}".format(key, freq)) |