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 "wxbind/include/wxbinddefs.h" | |
#include "wxbind/include/wxcore_bind.h" | |
WXLUA_DECLARE_BIND_ALL | |
wxLuaState& GetWxLuaState() | |
{ | |
struct wxLuaStateInstance | |
{ |
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
# 实际上,下面的解法不是O(n),而是O(n + k),其中k是出现数字的区间大小。 | |
def consecutive(numbers): | |
# get the min and max of the numbers | |
min, max = None, None | |
for n in numbers: | |
if min is None or min > n: | |
min = n | |
if max is None or max < n: | |
max = n |
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
from sqlalchemy import (create_engine, Column, select, case, func, ForeignKey) | |
from sqlalchemy import Integer, String, Boolean | |
from sqlalchemy.orm import sessionmaker, MapperExtension, aliased | |
from sqlalchemy.orm import relationship, backref | |
from sqlalchemy.ext.declarative import declarative_base | |
import weakref | |
import sys | |
import gc | |
engine = create_engine('sqlite://', echo=True) |
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
import os | |
import sys # import sys and os for convinience | |
import readline | |
import rlcompleter | |
# change autocomplete to tab | |
readline.parse_and_bind("tab: complete") | |
del readline, rlcompleter |
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
#! /usr/bin/env python | |
import smtplib | |
import subprocess | |
import os | |
import sys | |
from email.mime.text import MIMEText | |
_MAIL_SERVER = "192.168.1.100" |
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
int main(int argc, char** argv) | |
{ | |
// solution here. | |
return 0; | |
} |
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> | |
#include <cctype> | |
#include <iostream> | |
using namespace std; | |
int main(int argc, char *argv[]) | |
{ | |
bool is_start = false; | |
int count = 0; |
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 <iostream> | |
using namespace std; | |
int binary_search(int array[], const int size, const int elem) | |
{ | |
int left = 0; | |
int right = size; |
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 <iostream> | |
#include <unistd.h> | |
#include <cstring> | |
#include <new> | |
using namespace std; | |
struct ListNode | |
{ |
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
static int count[256]; | |
bool unique(const std::string& s) | |
{ | |
memset(count, 0, sizeof(count)); | |
const int size = s.size(); | |
for (int i = 0; i < size; ++i) | |
{ | |
if (count[s[i]] > 0) | |
{ |