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
set nocompatible | |
syntax enable | |
set encoding=utf-8 | |
set showcmd " display incomplete commands | |
"" Whitespace | |
set nowrap " don't wrap lines | |
set tabstop=2 shiftwidth=2 " a tab is two spaces | |
set expandtab " use spaces, not tabs | |
set backspace=indent,eol,start " backspace through everything in insert mode |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
template <typename t> | |
typename vector<t>::iterator mbsearch(vector<t> &haystack, t key) | |
{ | |
typename vector<t>::iterator left, middle, right; | |
left = haystack.begin(); |
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 | |
$domain_list = array('deer', 'hippo', 'lion'); | |
$domain = empty($_GET['domain']) ? '' : $_GET['domain']; | |
$address = empty($_GET['address']) ? '' : $_GET['address']; | |
if ($domain && $address && in_array($domain, $domain_list)) { | |
file_put_contents($domain.'.txt', $address); | |
echo 'OK'; | |
} 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 <sys/time.h> // for gettimeofday() | |
class StopWatch { | |
timeval started; | |
std::string msg; | |
public: | |
StopWatch(const std::string& m): msg(m) | |
{ gettimeofday(&started, NULL); } |
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 <stdlib.h> | |
#include <stdio.h> | |
/** | |
* @file reverse.c | |
* @brief 反转按照‘;’分割的字符串 | |
* @author [email protected] | |
* @version 0.0.1 | |
* @date 2012-04-24 | |
*/ |
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 <stdlib.h> | |
#include <stdio.h> | |
struct node { | |
int item; | |
struct node* next; | |
}; | |
typedef struct node node; | |
typedef node * link_list; |
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 <cstdio> | |
#include <cstdlib> | |
#include <stdint.h> | |
struct UInt64 { | |
uint32_t high; | |
uint32_t low; | |
}; | |
UInt64 multiply(uint32_t a, uint32_t b) |
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 <fcntl.h> | |
#include <unistd.h> | |
#include <stdint.h> | |
#include <inttypes.h> | |
int main() | |
{ |
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 <string.h> | |
#include <uthash.h> | |
// this is an example of how to do a LRU cache in C using uthash | |
// http://uthash.sourceforge.net/ | |
// by Jehiah Czebotar 2011 - [email protected] | |
// this code is in the public domain http://unlicense.org/ | |
#define MAX_CACHE_SIZE 100000 |
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 <iostream> | |
#include <string> | |
#include <map> | |
using namespace std; | |
struct entry { | |
entry(string k, int v, entry *n, entry *p): | |
key(k), value(v), next(n), prev(p){} | |
string key; | |
int value; |
OlderNewer