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
#! /bin/sh | |
# http://mvnrepository.com/artifact/org.apache.tika/tika-app | |
java -jar ~/libexec/tika-app-1.5.jar -t $@ |
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
(defun insert-placeholder-img-tag (gray-p width height category) | |
"insert placeholder image tag with lorempixel.com" | |
(interactive | |
(list current-prefix-arg | |
(read-number "width: ") | |
(read-number "height: ") | |
(completing-read | |
"category: " | |
'("animals" "business" "cats" "abstract" "city" | |
"food" "nightlife" "fashion" "people" |
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
;;; `boot repl` to go | |
(set-env! :dependencies '[[org.apache.tika/tika-parsers "1.10"]]) | |
(import '(org.apache.tika metadata.Metadata | |
parser.ParseContext | |
parser.rtf.RTFParser) | |
'(java.io StringWriter FileInputStream) | |
'(javax.xml.transform sax.SAXTransformerFactory | |
stream.StreamResult | |
OutputKeys)) |
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
(import com.rtfparserkit.parser.standard.StandardRtfParser | |
com.rtfparserkit.parser.RtfStreamSource | |
com.rtfparserkit.utils.RtfDump) | |
(require '[clojure.java.io :as io]) | |
(use 'clojure.pprint) | |
(def c-counter (atom 0)) | |
(def b-counter (atom 0)) | |
(def s-counter (atom 0)) | |
(def cmd-counter (atom 0)) |
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
(defun browse-current-buffer-file () | |
(interactive) | |
(let ((b (buffer-file-name))) | |
(if b | |
(browse-url b) | |
(message "This buffer is not associated with a file.")))) |
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
#! /bin/sh | |
eval `identify -format "convert -size %wx%h xc:gray $1" $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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 'nokogiri' | |
#1 | |
elm = Nokogiri::XML::Node.new("meta", Nokogiri::HTML::DocumentFragment.parse("")) | |
elm['http-equiv'] = "Content-Type" | |
elm['content'] = "text/html; charset=UTF-8" | |
puts elm.to_s | |
#2 | |
elm = Nokogiri::HTML::DocumentFragment.parse('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">').children[0] |
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 'nokogiri' | |
open('xxx.html') {|f| | |
doc = Nokogiri::HTML(f) | |
puts doc.css('head > meta[http-equiv="Content-Type"]')[0]['content'] | |
} |
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 'nokogiri' | |
open('xxx.html') {|f| | |
doc = Nokogiri::HTML(f) | |
doc.css('script, noscript').each(&:unlink) | |
open(output_filename, mode='w'){|f| | |
html_str = doc.to_html(encoding: 'UTF-8') | |
f.print html_str | |
} | |
} |
OlderNewer