Skip to content

Instantly share code, notes, and snippets.

View zhenwenc's full-sized avatar

Frederick Cai zhenwenc

View GitHub Profile
@zhenwenc
zhenwenc / findBarcode.py
Last active December 14, 2021 23:17
Improve QR Code Recognition from Image
from flask import Flask, jsonify, request
from pyzbar.pyzbar import decode
from pyzbar.pyzbar import ZBarSymbol
import cv2
import numpy as np
import base64
import urllib
import pdf2image
@zhenwenc
zhenwenc / DoobieSyntax.scala
Last active July 17, 2023 19:55
Doobie ConnectionIO helpers for use with Quill integration
import doobie._
import doobie.implicits._
import cats.data.NonEmptyList
import cats.implicits._
sealed abstract class UnexpectedResultSetSize(msg: String) extends Exception(msg)
final case object UnexpectedOptionalContinuation
extends UnexpectedResultSetSize(s"Expected ResultSet with zero or one row, but more rows were available.")
@zhenwenc
zhenwenc / buildSchema.js
Last active November 3, 2021 22:48
Generate Apollo API based on remote GraphQL schema merging with schemas for local state
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const https = require('https');
const yargs = require('yargs');
const fetch = require('node-fetch');
const { parse, execute, buildSchema } = require('graphql');
const { makeExecutableSchema } = require('graphql-tools');