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
POST_URL='https://api.fieldbook.com/v1/<USER_ID>/<SHEET_ID>' | |
KEY='...' | |
SECRET='...' | |
def get_fieldbook_json(): | |
try: | |
response = requests.get(POST_URL, auth=(KEY, SECRET)) | |
if response.status_code != 200: | |
return None | |
return response.json() |
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 requests | |
import xml.etree.ElementTree as ET | |
import sys | |
class Pastebin: | |
def __init__(self, api_key, user_key): | |
self.api_key, self.user_key = api_key, user_key | |
self.session = requests.session() | |
def _post(self, option, data = None): | |
data = data.copy() if data 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
def minor(a, row, col): | |
result = [] | |
for line in a[:row] + a[row+1:]: | |
result.append(line[:col] + line[col+1:]) | |
return result | |
def determinant(a): | |
if len(a) == 2: | |
return a[0][0] * a[1][1] - a[1][0] * a[0][1] | |
result = 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
BIN = wted | |
LIBS = -lchthon2 | |
SOURCES = $(wildcard *.cpp) | |
OBJ = $(addprefix tmp/,$(SOURCES:.cpp=.o)) | |
#WARNINGS = -pedantic -Werror -Wall -Wextra -Wformat=2 -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wuninitialized -Wunused -Wfloat-equal -Wundef -Wno-endif-labels -Wshadow -Wcast-qual -Wcast-align -Wconversion -Wsign-conversion -Wlogical-op -Wmissing-declarations -Wno-multichar -Wredundant-decls -Wunreachable-code -Winline -Winvalid-pch -Wvla -Wdouble-promotion -Wzero-as-null-pointer-constant -Wuseless-cast -Wvarargs -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=format | |
CXXFLAGS = -MD -MP -std=c++0x $(WARNINGS) | |
all: $(BIN) |
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
SDL_Texture * Sprite::load(SDL_Renderer * renderer, const char ** xpm, int size) | |
{ | |
SDL_Texture * result = 0; | |
try { | |
std::vector<std::string> xpm_lines(xpm, xpm + size); | |
Chthon::Pixmap pixmap; | |
pixmap.load(xpm_lines); | |
SDL_Surface * surface = SDL_CreateRGBSurface(SDL_SWSURFACE, | |
pixmap.pixels.width(), pixmap.pixels.height(), 32, | |
0x00ff0000, |