I hereby claim:
- I am l3thal on github.
- I am l3thal (https://keybase.io/l3thal) on keybase.
- I have a public key whose fingerprint is 5E04 F2F0 E0A1 E915 25DB 6052 BEDD DFF2 5540 86B5
To claim this, I am signing this object:
#!/usr/bin/ruby | |
require 'zip' | |
require 'nokogiri' | |
#Zip::ZipFile.open("sample.pptx").each{ |entry| puts Nokogiri::XML.parse(zip.find_entry(entry.to_s).get_input_stream).text.split(' ').uniq.length if entry.to_s.match(/ppt\/slides\/slide[0-9]+\.xml$/) } | |
class Pptx | |
def self.word_count(file, zip=Zip::ZipFile.open(file), count=nil) |
#!/usr/bin/ruby | |
require 'zip' | |
require 'nokogiri' | |
class Docx | |
def self.word_count(file, zip=Zip::ZipFile.open(file)) | |
Nokogiri::XML.parse(zip.find_entry("word/document.xml").get_input_stream).text.split(" ").uniq.length | |
end | |
end |
#!/bin/bash | |
# rename doc files with spaces | |
find . -depth -name '*.doc' | while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" 2>/dev/null; done | |
# convert doc files to docx | |
for i in `find ./ -name "*.doc" 2>/dev/null` | |
do | |
dir=$(dirname ${i})"/"; | |
libreoffice --headless --convert-to docx:"MS Word 2007 XML" --outdir $dir $i; | |
done |
I hereby claim:
To claim this, I am signing this object:
def flatten(list, result=[]) | |
list.each do |item| | |
if item.is_a? Integer | |
result << item | |
else | |
result += flatten(item) | |
end | |
end | |
res | |
end |