Skip to content

Instantly share code, notes, and snippets.

View jevy-wangfei's full-sized avatar
🎯
Focusing

Jevy jevy-wangfei

🎯
Focusing
View GitHub Profile
@jevy-wangfei
jevy-wangfei / postgres.py
Created August 24, 2021 05:17 — forked from goldsborough/postgres.py
Python psycopg2 wrapper
###########################################################################
#
## @file postgres.py
#
###########################################################################
import psycopg2
###########################################################################
#
@jevy-wangfei
jevy-wangfei / connectionpool.py
Created August 24, 2021 05:16 — forked from santosh/connectionpool.py
Connection pooling with PostgreSQL in Python.
from psycopg2.extras import DictCursor
from psycopg2.pool import SimpleConnectionPool
class Database:
__pool = None
@classmethod
def initialize(cls, **kwargs):
cls.__pool = SimpleConnectionPool(minconn=2,
const svgChartDom = document.getElementById("svg-element");
const svgSize = svgChartDom.getBoundingClientRect();
const svgChart = new XMLSerializer().serializeToString(svgChartDom);
let canvas = document.createElement("canvas");
canvas.width = svgSize.width;
canvas.height = svgSize.height;
let ctx = canvas.getContext("2d");
// Use canvg package to create canvas, resolve the limitation of IE, where drawing SVG would taint the canvas
let v = Canvg.fromString(ctx!, svgChart);
v.start();