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
/* | |
* Demo of libpq. | |
* Build: g++ libpq-demo.cc -o libpq-demo -lpq | |
* Run: ./libpq-demo | |
*/ | |
#include <arpa/inet.h> | |
#include <iostream> | |
#include <libpq-fe.h> | |
#include <sstream> |
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
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
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 flask import Flask, request, jsonify, json, abort | |
from flask_cors import CORS, cross_origin | |
import pandas as pd | |
app = Flask(__name__) | |
cors = CORS(app) | |
app.config['CORS_HEADERS'] = 'Content-Type' |
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
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
background-color: white; | |
padding: 30px; } | |
body > *:first-child { |
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
# author: the5fire.com | |
import re | |
import socket | |
from collections import namedtuple | |
RE_URL = re.compile(r'http://(.*)') | |
RE_CONTENT_LENGTH = re.compile(b'.*Content-Length: (\d+)') | |
EOF = '\r\n\r\n' | |
Response = namedtuple('Response', ['header', 'body']) |
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
"""Generate cryptographically strong pseudo-random numbers suitable for | |
managing secrets such as account authentication, tokens, and similar. | |
See PEP 506 for more information. | |
https://www.python.org/dev/peps/pep-0506/ | |
""" | |
__all__ = ['choice', 'randbelow', 'randbits', 'SystemRandom', | |
'token_bytes', 'token_hex', 'token_urlsafe', |
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 django.http import QueryDict | |
from django.http.multipartparser import MultiValueDict | |
class RESTMiddleware(object): | |
def process_request(self,request): | |
request.PUT=QueryDict('') | |
request.DELETE = QueryDict('') | |
method = request.META.get('REQUEST_METHOD','').upper() #upper ? rly? | |
if method == 'PUT': | |
self.handle_PUT(request) |