Using JSON in Postgres by example.
- Download and install: Docker Toolbox
- Open Docker Quickstart Terminal
- Start a new postgres container:
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
// Attempt at making a Boost grammar that successfully parses Jason Shankel's predicate logic language | |
// #define BOOST_SPIRIT_DEBUG | |
#include <boost/spirit/include/qi.hpp> | |
#include <boost/variant/recursive_variant.hpp> | |
#include <boost/fusion/include/adapt_struct.hpp> | |
#include <boost/spirit/include/phoenix.hpp> | |
#include <boost/optional.hpp> | |
// start with the AST |
// C module for data stack manager | |
// See below for lua lib wrapper | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
#define MINCAP 128 |
local account = "[email protected]" -- use your own gmail account | |
local password = "password" -- if you enable 2-phase authentication, you need to | |
-- generate and use a application-specific password here... | |
local sender_name = "Jon Snow" | |
local recipient = "[email protected]" | |
local recipient_name = "Arya Stark" | |
local mail_title = "This is a test mail" | |
local mail_body = [[<html><body><p>Mail Body...</body></html>]] |
Using JSON in Postgres by example.
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
local cjson = require "cjson.safe" | |
local js = require "lib.resty.jsonschema/compiler" | |
local g = js.new({type={"integer", "boolean"}}) | |
-- print(g:code()) | |
local g = js.new({enum = {"a", "b", cjson.null, "d"}}) | |
-- print(g:code()) |
This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.
http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
def gen_byte(path): | |
with open(path) as fd: | |
while True: | |
buf = fd.read(4096) |
local pcall = pcall | |
local setmetatable = setmetatable | |
local ok, table_new = pcall(require, "table.new") | |
if not ok then | |
table_new = function(narr, nrec) return {} end | |
end | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include "zlib.h" | |
int gzip_compress(uint8_t *src, size_t srclen, uint8_t *dest, size_t *destlen, | |
int level) { | |
int rc, wbits, memlevel; | |
z_stream zstream; |