Skip to content

Instantly share code, notes, and snippets.

Avatar

mparaiso Mparaiso

View GitHub Profile
@posener
posener / go-kit.md
Last active Jul 3, 2021
Why I Recommend to Avoid Using the go-kit Library
View go-kit.md

Why I Recommend to Avoid Using the go-kit Library

There is a trending 'microservice' library called go-kit. I've been using the go-kit library for a while now. The library provide a lot of convenience integrations that you might need in your service: with service discovery with Consul, distributed tracing with Zipkin, for example, and nice logic utilities such as round robin client side load balancing, and circuit breaking. It is also providing a way to implement communication layer, with support of RPC and REST.

@nathan-osman
nathan-osman / win32.go
Last active Jul 16, 2021
Simple Windows GUI application written in Go
View win32.go
package main
import (
"log"
"syscall"
"unsafe"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")
@NullVoxPopuli
NullVoxPopuli / angular-pls.md
Last active Jul 9, 2020
Anti Patterns (and things I don't like) in Angular2
View angular-pls.md

General

Templates written a giant string in components.

This tutorial demonstrates this: https://angular.io/docs/ts/latest/tutorial/toh-pt1.html you don't get syntax coloring, or any benefits you'd get from a good html/templating tool.

(( flashbacks to inline html strings in C++ ))

Tag bloat with ngDirectives (such as ngFor)

from an angular.io example:

@dannguyen
dannguyen / README.md
Last active Apr 20, 2021
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data
View README.md

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

@joyrexus
joyrexus / README.md
Last active Nov 28, 2020
nested templates in go
View README.md

Example of nested templates.

Given this file layout ...

.
├── server.go
└── templates
    ├── profiles.html
    └── layout.html
View gist:19954506283377fb44be
// model
function Model () {
this._state = {}
return this
}
Model.prototype.get = function (key) {
return this._state[key]
}
@kristopolous
kristopolous / yo-dawg-toplevel.js
Last active Aug 29, 2015
Yo dawg, I heard you liked PHP and Javascript so I made your Javascript work like PHP...
View yo-dawg-toplevel.js
//
// toplevel.js
//
// TopLevel enables you to template your HTML, CSS, and Javascript at the Top Level
// (c) 2014 chris mckenzie. see LICENSE for more details.
// https://github.com/kristopolous/TopLevel for the latest version.
//
// Parts of this code use Jeremy Ashkenas' underscore library, available at
// https://github.com/jashkenas/underscore and protected by the license specified
// therein.
View gist:3d0b9deab6f5969c354b

Hello World!

###this is a gist test

  • with
  • a
  • list
  • that
  • works
@subudeepak
subudeepak / WebSockets.md
Last active Apr 30, 2021
The problems and some security implications of websockets - Cross-site WebSockets Scripting (XSWS)
View WebSockets.md

WebSockets - An Introduction

WebSockets is a modern HTML5 standard which makes communication between client and server a lot more simpler than ever. We are all familiar with the technology of sockets. Sockets have been fundamental to network communication for a long time but usually the communication over the browser has been restricted. The general restrictions

  • The server used to have a permanent listener while the client (aka browser) was not designated any fixed listener for a more long term connection. Hence, every communication was restricted to the client demanding and the server responding.
  • This meant that unless the client requested for a particular resource, the server was unable to push such a resource to the client.
  • This was detrimental since the client is then forced to check with the server at regular intervals. This meant a lot of libraries focused on optimizing asynchronous calls and identifying the response of asynchronous calls. Notably t
@substack
substack / par_server.js
Created Mar 30, 2014
co + thunkify http servers
View par_server.js
// parallel steps
var co = require('co');
var http = require('http');
var fs = require('fs');
var thunkify = require('thunkify');
var server = http.createServer(co(function *(req, res) {
var files = yield {
a: thunkify(fs.readFile)('a.txt'),