Skip to content

Instantly share code, notes, and snippets.

View DMarby's full-sized avatar

David Marby DMarby

View GitHub Profile
@xahare
xahare / Docker-on-qubes.md
Last active April 3, 2024 12:43
How to run docker on Qubes-OS
@xahare
xahare / vagrant-qubes.md
Last active July 11, 2023 15:43
Vagrant on Qubes-OS

Vagrant on Qubes-OS

(Vagrant)[https://www.vagrantup.com] "Development Environments Made Easy"

(Qubes-OS)[https://www.qubes-os.org] "A Reasonably Secure Operating System."

This is a guide on to using vagrant on qubes-os with qemu using the libvirt provider. Because qubes-os does not support nested virtualization, you'r stuck with emulation. If you want performance, use a system with a proper vagrant setup.

Template Setup

@dannguyen
dannguyen / README.md
Last active December 28, 2023 15:21
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs

@lopspower
lopspower / README.md
Last active April 25, 2024 12:17
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@nijikokun
nijikokun / about.md
Last active August 29, 2015 14:17
Reverse-routing done right for Express 3/4

Reverse Routing for Express

Benefits:

  • Reverse routing (with query support)
  • Enforcement of utilizing Controllers
  • Global middleware per Controller
  • Seperate method from middleware for testability
  • Probably other things.. but those are the most important.
@nijikokun
nijikokun / mongoose.local.passport.js
Created March 7, 2015 01:59
Mongoose Passport LocalStrategy Plugin, supports PBKDF2, BCrypt, MD5
var LocalStrategy = require('passport-local').Strategy;
var crypto = require('crypto');
var bcrypt = require('bcrypt');
var util = require('util');
function BadRequestError (message) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'BadRequestError';
this.message = message || null;
@cerebrl
cerebrl / 1-securing-express.md
Last active August 2, 2023 22:48
Securing ExpressJS

tl;dr

  1. Don't run as root.
  2. For sessions, set httpOnly (and secure to true if running over SSL) when setting cookies.
  3. Use the Helmet for secure headers: https://github.com/evilpacket/helmet
  4. Enable csrf for preventing Cross-Site Request Forgery: http://expressjs.com/api.html#csrf
  5. Don't use the deprecated bodyParser() and only use multipart explicitly. To avoid multiparts vulnerability to 'temp file' bloat, use the defer property and pipe() the multipart upload stream to the intended destination.
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying