Skip to content

Instantly share code, notes, and snippets.

Michal Kulesza mic-kul

Block or report user

Report or block mic-kul

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mic-kul
mic-kul / cert2bundle.rb
Created Mar 24, 2016
generate #ready-to-use-with-nginx bundle.crt from single certificate
View cert2bundle.rb
#!/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"
View bypass_openssl_verification.rb
# 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 / collector.rb
Created Oct 24, 2015
NewRelic local collector
View collector.rb
require 'sinatra'
require 'sinatra/namespace'
require 'sinatra/json'
require 'base64'
require 'json'
require 'zlib'
require 'stringio'
require 'pry'
@mic-kul
mic-kul / spacy_intro.ipynb
Created Feb 22, 2018 — 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/
View spacy_intro.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View textstream.rb
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
You can’t perform that action at this time.