Skip to content

Instantly share code, notes, and snippets.

@mic-kul
mic-kul / textstream.rb
Created May 17, 2018 12:48
PDF Textstream
def self.file_path_to_text(path)
# TODO: exception handling
pdfParser = PDFParser.new(RandomAccessFile.new(Java::JavaIo::File.new(path), "r"))
pdfParser.parse()
pdDocument = PDDocument.new(pdfParser.getDocument());
pdfTextStripper = PDFLayoutTextStripper.new
string = pdfTextStripper.getText(pdDocument);
return string
end
@mic-kul
mic-kul / spacy_intro.ipynb
Created February 22, 2018 10:15 — forked from aparrish/spacy_intro.ipynb
NLP Concepts with spaCy. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mic-kul
mic-kul / collector.rb
Created October 24, 2015 14:21
NewRelic local collector
require 'sinatra'
require 'sinatra/namespace'
require 'sinatra/json'
require 'base64'
require 'json'
require 'zlib'
require 'stringio'
require 'pry'
# initializers/bypass_openssl_verification.rb
require 'openssl'
# Ruby 1.9.3:
if Rails.env.development?
OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
end
# Ruby > 2.x
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE if Rails.env.development?
@mic-kul
mic-kul / cert2bundle.rb
Created March 24, 2016 13:46
generate #ready-to-use-with-nginx bundle.crt from single certificate
#!/usr/bin/env ruby
# cert2bundle.rb
# author: @mic-kul
# USAGE: ./cert2bundle.rb some.domain.crt
# generates #ready-to-use-with-nginx bundle.crt in current working directory
require "openssl"
require "net/http"
require "uri"