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> | |
typedef enum { | |
ST_RADIO, | |
ST_CD | |
} STATES; | |
typedef enum { | |
EVT_MODE, | |
EVT_NEXT |
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 <dirent.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
int main(int argc, char *argv[]) | |
{ | |
if (argc != 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> | |
int second_max_length(int array[], const int length, int &second_max) | |
{ | |
if((array == NULL) || (length < 2)){ | |
return 0; | |
} | |
int i; |
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
# 方法1 | |
with open('/tmp/track-this') as f: | |
while True: | |
line = f.readline() | |
if line: | |
print line | |
# 方法2 | |
import time | |
def follow(thefile): |
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
<html> | |
<head> | |
<title>This is title</title> | |
<script type="text/javascript" src="jquery.js"></script> | |
<style type="text/css"> | |
body | |
{ | |
font-size: 12pt; | |
font-family: Calibri; | |
padding : 10px; |
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
<?php | |
/*******EDIT LINES 3-8*******/ | |
$DB_Server = "localhost"; //MySQL Server | |
$DB_Username = "username"; //MySQL Username | |
$DB_Password = "password"; //MySQL Password | |
$DB_DBName = "databasename"; //MySQL Database Name | |
$DB_TBLName = "tablename"; //MySQL Table Name | |
$filename = "excelfilename"; //File Name | |
/*******YOU DO NOT NEED TO EDIT ANYTHING BELOW THIS LINE*******/ | |
//create MySQL connection |
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
#从列表的特定位置迭代,比如从第五项迭代到末尾,可以用下面的方法,当然也可以把列表从指定位置分片后再迭代 | |
for i in list_inst[4:]: | |
process | |
#可以对可迭代对象进行解包操作,类似于下面这样的形式,只要两边的参数个数匹配即可 | |
m = [1, 2, 3] | |
p, q, r = m | |
#自定义异常类的定义,触发,处理 | |
#!/usr/bin/python |
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
find . -type f -exec stat -c "%s %n" {} \;|sort -n|tail -n 1 |
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 -vFS="" '{a[$1]++}END{for (i in a) if(match(i,/[a-z]/)) {b[i]=a[i]+a[toupper(i)];print i","b[i]}}' /usr/share/dict/words|sort -t "," -nrk 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
#Version 1 | |
read -p "please input the length of passwd: " p | |
list=(0 1 2 3 4 5 6 7 8 9 a b c d A B C D + -) | |
for i in $(seq $p); do | |
echo -n ${list[$RANDOM % ${#list[*]}]} | |
done |
NewerOlder