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
| #!/usr/bin/env ruby | |
| # Usage: bundle-grep -E "^foo" | |
| require "bundler" | |
| lockfile = Bundler::LockfileParser.new(File.read("Gemfile.lock")) | |
| gem_paths = lockfile.specs.map{|lazy_spec| lazy_spec.__materialize__.full_gem_path } | |
| command = ["find", *gem_paths, "-type", "f"].shelljoin + " | " + | |
| ["xargs", "grep", *ARGV].shelljoin | |
| exec(command) |
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
| <!doctype html> | |
| <meta charset="utf-8"> | |
| <!-- Please download Bravura font from https://www.smufl.org/fonts/ --> | |
| <style> | |
| @font-face { | |
| font-family: "BravuraText"; | |
| src: url(BravuraText.woff); | |
| } | |
| .bravura { | |
| font-family: "BravuraText"; |
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
| require "nokogiri" | |
| # > (sforzato) より . (staccato) のがあとにないと音価が変わらないので sort | |
| doc = Nokogiri.parse(ARGF.read) | |
| doc.css("Chord").each do |chord| | |
| sorted = chord.css("Articulation").map(&:dup).sort_by{|a| a.css("subtype").text } | |
| chord.css("Articulation").each do |e| | |
| e.remove | |
| 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
| #!/usr/bin/env ruby | |
| # Convert Inkdrop backup files (.json) to TextBundle v2 (.textbundle).for importing to Bear | |
| # Usage: inkdrop2textbundle note:*.json | |
| require "json" | |
| require "tmpdir" | |
| require "fileutils" | |
| require "base64" | |
| def inkdrop_to_textbundle(src) |
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
| #!/usr/bin/env ruby | |
| # Removing first blank pages from PDFs. | |
| # Usage: remove-blank-pages [path/to/pdf...] | |
| # Requirements: | |
| # identify (ImageMagick: https://www.imagemagick.org/) | |
| # cpdf (Coherent PDF Tools: https://www.coherentpdf.com/) | |
| require "open3" | |
| require "tmpdir" | |
| require "shellwords" |
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
| #!/usr/bin/env ruby | |
| # sort .rubocop.yml (with comments) | |
| file = ARGV.first | |
| cops = [] | |
| yaml = File.read(file) | |
| lines = [] | |
| previous_indent = 0 |
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
| require "open3" | |
| def sh(*args) | |
| o, e, s = Open3.capture3(*args) | |
| unless s.success? | |
| $stderr.puts e | |
| exit s.to_i | |
| end | |
| o | |
| 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
| #!/usr/bin/env ruby | |
| # Convert QVR Pro Playback API response (with gop_mode=1) to .264 file. | |
| # Usage: ./q264to264 in.q264 > out.264 | |
| def assert(cond) | |
| raise unless cond | |
| end | |
| def i32(f) | |
| f.read(4).unpack("I<")[0] |
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
| # Requirements: poppler (for pdfinfo) | |
| require "open3" | |
| require "shellwords" | |
| require "optparse" | |
| PRINTER_NAME = "Officejet_7610_series" | |
| def sh(*args) | |
| $stderr.puts(args.first + " " + args[1..-1].shelljoin) | |
| o, e, s = Open3.capture3(*args) |