This file contains 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
#!/usr/bin/ruby | |
# * coding: utf-8 * | |
class PDFExtract | |
def self.main | |
ARGV.each {|a| new.extract a } | |
end | |
def extract(pdf) | |
images = parse_info(`mutool info #{pdf}`) |
This file contains 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
#!/usr/bin/env ruby | |
# coding: utf-8 | |
require 'socket' | |
ARGV.size == 2 or abort "usage: #$0 hostname port" | |
host, port = ARGV | |
sec = 1 |
This file contains 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
require 'socket' | |
require 'openssl' | |
def wrap(server) | |
key = OpenSSL::PKey::RSA.generate(2048) | |
cert = OpenSSL::X509::Certificate.new | |
cert.issuer = cert.subject = OpenSSL::X509::Name.new([['CN', 'localhost']]) | |
cert.public_key = key.public_key | |
cert.not_before = Time.now | |
cert.not_after = cert.not_before + 60 * 60 |
This file contains 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
require 'tempfile' | |
class DLL | |
include Enumerable | |
attr_reader :path | |
def initialize(path) | |
@path = path | |
end |
This file contains 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
127.0.0.1 *.2mdn.net | |
127.0.0.1 *.adnxs.com | |
127.0.0.1 *.adtech.de | |
127.0.0.1 *.atdmt.com | |
127.0.0.1 *.flashtalking.com | |
127.0.0.1 *.msads.net | |
127.0.0.1 *.msecn.net | |
127.0.0.1 *.msn.com | |
127.0.0.1 *.serving-sys.com | |
127.0.0.1 *.doubleclick.net |
This file contains 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
require 'fileutils' | |
require 'openssl' | |
require 'open-uri' | |
CACERT_URI = 'https://curl.haxx.se/ca/cacert.pem' | |
def main | |
if force = ARGV.include?('-f') || ARGV.include?('--force') | |
u = FileUtils::Verbose | |
else |
This file contains 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 parse_yaml_with_pretty_error(str) | |
YAML.load(str) | |
rescue Psych::SyntaxError => e | |
range = e.line - 5..e.line + 5 | |
str.lines[range].zip(range) {|s, n| warn "#{n + 1}: #{s}#{%_#{' ' * (e.column - 1)}^_ if n + 1 == e.line}" } | |
raise | |
end |
This file contains 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
if (document.selection.IsEmpty) { | |
document.selection.EndOfLine(false, mePosLogical) | |
document.selection.StartOfLine(true, mePosLogical) | |
} | |
var shell = new ActiveXObject('WScript.Shell') | |
shell.CurrentDirectory = document.Path || shell.SpecialFolders("Desktop") | |
var exec = shell.Exec('rubyw.exe -rtimeout -e "STDERR.reopen STDOUT; $0 = STDIN.gets.rstrip; print begin; Timeout.timeout(2) { eval($_ = STDIN.read) }; rescue Exception; %_#<#{$!.class}:#{$!.message}>_ end"') | |
exec.StdIn.WriteLine(document.FullName) |
This file contains 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
require 'yaml' | |
# StringForest = nil | (String, StringForest)[] | |
# String -> StringForest | |
def parse_indented_forest(str) | |
str = str.gsub(/^( *)([^": \n][^":\n]*)$/, '\1"\2":') | |
handle_includes YAML.load(str) | |
end | |
def handle_includes(tree) |
This file contains 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
# coding: utf-8 | |
# | |
# tom: JSPのタグ開閉の対応チェッカ | |
# MIT license, @snipsnipsnip | |
# | |
=begin | |
JSPの文法は普通のHTMLと違ってかなりゆるい。 |