Skip to content

Instantly share code, notes, and snippets.

@take-five
Created May 23, 2014 06:37
Show Gist options
  • Save take-five/b0182d2fad1f2df0be67 to your computer and use it in GitHub Desktop.
Save take-five/b0182d2fad1f2df0be67 to your computer and use it in GitHub Desktop.
./extract.sh | wc -l
#!/bin/bash
cat <(./facebook_messages.rb) <(./facebook_messages.rb) |
./split.rb |
./lowercase.rb |
egrep '.{2,}' |
sort | uniq |
./mystem -w -n -e utf-8 |
grep -v '??' |
sed -n -e '$!N' -e 's/\n//g' -e 's/.*{\([^{][^{]*\)}.*/\1/gp' |
awk -F\| '{ for (i = 0; ++i <= NF; )print $i }' |
sort | uniq
#!/usr/bin/env ruby
require 'bundler/setup'
require 'nokogiri'
input = './facebook-amikhailov83/html/messages.htm'
doc = Nokogiri::HTML(open(input))
doc.css('.message').each do |header|
author = header.css('.message_header span.user').first
if author.content == 'Алексей Михайлов'
message = header.next
puts message.content
end
end
#!/usr/bin/env ruby
require 'bundler/setup'
require 'nokogiri'
input = './facebook-amikhailov83/html/wall.htm'
doc = Nokogiri::HTML(open(input))
doc.css('.comment').each do |comment|
header = comment.previous.content
if header.include?('Алексей Михайлов') && !header.include?('posted something via')
puts comment.content
end
end
source 'https://rubygems.org'
gem 'nokogiri'
gem 'sanitize'
gem 'activesupport'
#!/usr/bin/env ruby
# coding: utf-8
require 'bundler/setup'
require 'active_support/core_ext/string/multibyte'
$stdin.each_line { |x| puts x.mb_chars.downcase }
#!/usr/bin/env ruby
$stdin.each_line do |line|
line.scan(/([а-я]+)(-[а-я]+)?/i).each do |x|
puts x.join
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment