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
class Parser(object): | |
def __call__(self, s): | |
self.remains_ = s | |
self.state_ = 'in_key' | |
self.key_ = [] | |
self.value_ = [] | |
disbatch = { | |
'in_key': self.in_key, | |
'in_value': self.in_value, |
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
# default to optional | |
Person: !message { | |
1 : {name: id, type: int32, required: Yes}, | |
2 : {name: name, type: string}, | |
3 : {name: email, type: string}, | |
PhoneType: !enum { | |
0 : MOBILE, |
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
# .ipython/profile_default/startup/00-start.py | |
import os | |
if 'PYTHONSTARTUP' in os.environ: | |
execfile(os.environ['PYTHONSTARTUP']) | |
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
http://stackoverflow.com/questions/15151480/simple-dictionary-in-c | |
enum class BasePair { A, T, C, G }; | |
BasePair Compliment ( BasePair bp ) | |
{ | |
using BasePair::A; | |
using BasePair::T; | |
using BasePair::C; | |
using BasePair::DG; |
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
typedef std::unique_ptr<std::FILE, int (*)(std::FILE *)> unique_fp; | |
unique_fp(std::fopen(filename, flags), std::fclose); | |
unique_ptr<std::FILE, decltype(&std::fclose)> p_file ( | |
std::fopen("easy.binary", "wb"), std::fclose); |
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 contextlib import contextmanager | |
@contextmanager | |
def tag(args): | |
ccontext = ctx(args) | |
yield context | |
context.close() |
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
HOMEBREW_VERSION: 0.9 | |
HEAD: 3525e4b730b03d8c49af07bc0332199124baf919 | |
HOMEBREW_PREFIX: /usr/local | |
HOMEBREW_CELLAR: /usr/local/Cellar | |
CPU: dual-core 64-bit penryn | |
OS X: 10.7.4 | |
Kernel Architecture: x86_64 | |
Xcode: 4.3.2 | |
GCC-4.0: N/A | |
GCC-4.2: build 5666 |
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
type_protobuf::Test target; | |
std::string raw; | |
google::protobuf::io::StringOutputStream output(&raw); | |
google::protobuf::io::CodedOutputStream encoder(&output); | |
encoder.WriteVarint32(target.ByteSize()); | |
target.SerializeToCodedStream(&encoder); | |
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
#!/usr/bin/env python | |
import csv | |
import datetime | |
import decimal | |
import urllib | |
def get(symbol, start, end, frequency='D'): | |
controller = 'http://ichart.yahoo.com/table.csv?' |
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
if [ -f ~/.bashrc ]; then | |
source ~/.bashrc | |
fi |
NewerOlder