This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_fields | |
# We have to use #send because AFAIK, PDF::Reader does not expose the root object anywhere | |
acroform = @reader.send(:root)[:AcroForm] | |
# PDF::Reader encapsulates each piece of PDF data in #objects. The field_refs are really references to | |
# these objects. We iterate through and de-reference the actual object, creating a AcroField based on its | |
# data | |
field_refs = @reader.objects[acroform][:Fields] unless acroform.nil? | |
fields = field_refs.map do |field_ref| | |
AcroField.new(@reader.objects[field_ref]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From http://breakthebit.org/post/77505127462/up-your-security-on-amazon-aws | |
{ | |
"Statement": [ | |
{ | |
"Sid": "AllowPublicRead", | |
"Action": [ | |
"s3:ListBucket", | |
"s3:GetObject", | |
"s3:PutObject", | |
"s3:PutObjectAcl", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract PDF field names and positions using pCOS: | |
./pcos --extended field "FT fullname Rect[0] Rect[1] Rect[2] Rect[3]" fw9.pdf | |
# CSV format, also output pagesize as the first line: | |
./pcos --extended pagesize "width height" --extended field "FT fullname V Rect[0] Rect[1] Rect[2] Rect[3]" --format "(VAL,)\n" --replace missing "" test.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This monkeypatch logs any calls to I18n#t. This is especially useful to "peaking" into what namespaces are expected | |
# for third party gems, e.g. simple_form or reform. | |
I18n.module_eval do | |
class << self | |
def translate_with_puts(*args) | |
Rails.logger.debug "#{args}" | |
old_translate(*args) | |
end | |
alias :old_translate :translate | |
alias :translate :translate_with_puts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://blog.foppiano.org/2007/12/11/installing-source-package-with-yum/ | |
# http://wiki.centos.org/HowTos/RebuildSRPM | |
cd /tmp | |
sudo yumdownloader --source zbar | |
sudo yum-builddep zbar-blah-blah.rpm | |
rpm -ivh packagename-version.src.rpm | |
cd ~/rpmbuild | |
copy patch to SOURCES |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stacktrace (most recent call first): | |
premailer/rails/css_loaders/network_loader.rb:17:in `uri_for_url' | |
::Rails.configuration.action_controller.asset_host.split(%r{:?//}) | |
premailer/rails/css_loaders/network_loader.rb:8:in `load' | |
uri = uri_for_url(url) | |
premailer/rails/css_helper.rb:33:in `block in load_css' | |
css = strategy.load(url) | |
premailer/rails/css_helper.rb:32:in `each' | |
STRATEGIES.each do |strategy| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# http://vm-192-168-11-21.shengyun.grandcloud.cn/topics/2437 | |
# redis - this script starts and stops the redis-server daemon | |
# | |
# chkconfig: 2345 90 10 | |
# description: Redis is a persistent key-value database | |
# processname: redis-server | |
# config: /etc/redis.conf | |
# config: /etc/sysconfig/redis | |
# pidfile: /var/run/redis.pid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -v -d code_url=http://mozilla.github.io/pdf.js/build/pdf.js -d compilation_level=SIMPLE_OPTIMIZATIONS -d output_info=errors -d output_format=text -d language=ECMASCRIPT5 http://closure-compiler.appspot.com/compile | |
curl -v -d code_url=http://mozilla.github.io/pdf.js/build/pdf.js -d compilation_level=SIMPLE_OPTIMIZATIONS -d output_info=compiled_code -d output_format=text -d language=ECMASCRIPT5 http://closure-compiler.appspot.com/compile > pdf.min.js | |
curl -v -d code_url=http://mozilla.github.io/pdf.js/build/pdf.worker.js -d compilation_level=SIMPLE_OPTIMIZATIONS -d output_info=compiled_code -d output_format=text -d language=ECMASCRIPT5 http://closure-compiler.appspot.com/compile > pdf.worker.min.js | |
curl -v -d code_url=http://mozilla.github.io/pdf.js/web/viewer.js -d compilation_level=SIMPLE_OPTIMIZATIONS -d output_info=compiled_code -d output_format=text -d language=ECMASCRIPT5 http://closure-compiler.appspot.com/compile > viewer.min.js | |
curl -v -d code_url=http://mozilla.github.io/pdf.js/web/l10n.js -d com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#initializers/i18n.rb | |
I18n.module_eval do | |
class << self | |
def translate_with_puts(*args) | |
Rails.logger.debug "#{args}" | |
old_translate(*args) | |
end | |
alias :old_translate :translate | |
alias :translate :translate_with_puts | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta name="format-detection" content="telephone=no" /> | |
<style> | |
h1 { | |
font-size:14pt; | |
} | |
h2 { | |
font-size:12pt; |