Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Chris Mendez chrisjmendez

🎯
Focusing
View GitHub Profile
@chrisjmendez
chrisjmendez / email_builder.rb
Created Apr 17, 2018
Create and parse XML into JSON
View email_builder.rb
#!/usr/bin/env ruby
require "faker"
require 'nokogiri'
require File.join(File.dirname(__FILE__), 'lib', 'file_manager')
class EmailUtil
include FileManager
NUM_OF_EMAILS = 5000
@chrisjmendez
chrisjmendez / vpc_w_public_ips_and_dns.yaml
Created Apr 2, 2018
How to create a VPC with DNS and Public IPs enabled.
View vpc_w_public_ips_and_dns.yaml
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'AWS CloudFormation Sample Template VPC_with_PublicIPs_And_DNS: Sample
template showing how to create a VPC with DNS and Public IPs enabled. You will be
billed for the AWS resources used if you create a stack from this template.'
Parameters:
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access to the bastion
host
Type: AWS::EC2::KeyPair::KeyName
@chrisjmendez
chrisjmendez / Rakefile
Created May 1, 2017
Converting a WAV file to FLAC with customization. https://superuser.com/a/1145254
View Rakefile
namespace :convert do
# https://superuser.com/a/1145254
desc %Q{ ›› Convert from WAC to FLAC to 16-bit and 44.1 kHz. }
task :low_res, [:wav, :flac] do |task, args|
wav = args.wav
flac = args.flac
bit_rate = 16
sample_rate = 44100
sh %{ ffmpeg -i #{wav} -af aformat=s#{bit_rate}:#{sample_rate} #{flac} }
end
View what-i-wish-id-known-about-equity-before-joining-a-unicorn.md

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@chrisjmendez
chrisjmendez / app.js
Last active Apr 8, 2016
Simple NodeJS Server to use in conjunction with Let's Encypt
View app.js
const http = require('http'),
fs = require('fs'),
path = require('path'),
contentTypes = require('./utils/content-types'),
sysInfo = require('./utils/sys-info'),
env = process.env;
let server = http.createServer(function (req, res) {
let url = req.url;
if (url == '/') {
@chrisjmendez
chrisjmendez / README.md
Created Mar 24, 2016 — forked from dannguyen/README.md
Using Google Cloud Vision API to OCR scanned documents to extract structured data
View README.md

Using 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

@chrisjmendez
chrisjmendez / ClassicaKUSC.csv
Last active Mar 22, 2016
Classical KUSC audit in JSON format prepared by http://crawly.diffbot.com/
View ClassicaKUSC.csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
type,title,author,date,diffbotUri,email,estimatedDate,height,humanLanguage,naturalHeight,naturalWidth,numPages,originalType,pageUrl,phoneNumber,primary,resolvedPageUrl,siteName,specs.administrationbrenda_barnes,specs.alexander_borodin,specs.antonio_vivaldi,specs.bill_kappelman,specs.bill_lueth,specs.cliff_nielsen,specs.developmentminnie_prince,specs.engineering_and_operationsron_thompson,specs.francis_poulenc,specs.gail_eichenthal,specs.hosts,specs.info,specs.jaime_cisneros,specs.kelsey_mcconnell,specs.kuscorg,specs.lilly_lau,specs.mark_hatwan,specs.need_help,specs.nicole_coe,specs.nicole_massingale,specs.programmingbill_lueth,specs.rina_romero,specs.shauna_der,specs.steve_coghill,specs.steve_sevy,specs.susannah_hutchison,specs.underwritingcorporate_supportabe_shefa,specs.veronica_jimenez,text,twitter,url,width
"article","Membership - Donate Your Car",,,"article|3|-1611848369",,,,"en",,,,,"http://www.kusc.org/donatecar",,,"http://www.kusc.org/donatecar/","KUSC",,,,,,,,,,,,,,,,,,,,,,,,,,,,,"Do you have a vehic
@chrisjmendez
chrisjmendez / StreamURI.md
Last active Sep 2, 2019
Triton Audio streams for Classical KUSC and Classical KDFC
View StreamURI.md

Stream URL's for Classical KUSC and Classical KDFC

New URL Pattern:

http://[bit rate].[encoder format].[file format].[call letters].live

Old URL Pattern:

@chrisjmendez
chrisjmendez / gist:5083093
Last active Dec 14, 2015
MongoDB Conference - Strategies
View gist:5083093

scalar-vector-operations

multi-key indexing allows for indexing properties within an array. It makes things fast [ red, blue, green ]

On the way out Is red in the colors array? Is red not in the colors array? Scalar: $ne, $mod, $exists, $type, $lt, $gt, $gte, $ne Vector: $in, $nin, $all, $size