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 | |
require 'find' | |
if ARGV[0] | |
puts "Wait..." | |
Find.find( ARGV[0] ) do |f| | |
totalLength += IO.readlines(f).size if File.file? f | |
end | |
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
#!/usr/bin/ruby | |
# Troca vogais e coloca um hifen no lugar das mesmas | |
# passe como argumento o arquivo de texto i.e. -> | |
# matavogais.rb /home/masterboss/vogais.txt | |
File.open("#{File.dirname(ARGV[0])}/noVogals.txt",'w') do |f| | |
f << File.read( ARGV[0] ).gsub(/[aeiou]/i, '-') | |
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
#!/usr/bin/ruby | |
# Example: wordor /anything/ ruby | |
# Found: anythingruby.pdf and rubynotify.rb, after put they in ruby/ folder | |
require 'find' | |
require 'fileutils' | |
if !ARGV.empty? | |
path = "#{ARGV[0]}/#{ARGV[1]}" | |
reg = /#{ARGV[1]}/ | |
Dir.mkdir( path,0755 ) unless File.exists? path |
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
function now(){ | |
return ( new Date ).getTime(); | |
} | |
function animate( time, fn, fps ){ | |
var start = now(), | |
intrval = fps ? 1000/fps : 20, | |
id = setInterval(function(){ | |
var diff = now() - start, p = diff/time; | |
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
# Show and enumerate the most frequently words in a file | |
# Use: | |
# $ chmod a+x frequently_words.sh | |
# $ ./frequently_words file_path | |
cat $1 | tr -cs A-Za-z '\n' | tr A-Z a-z | sort | uniq -c | sort -rn |
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
function analyse( text ){ | |
var words = {}, | |
text = text.toLowerCase() | |
.replace(/[.,]+/g, '') | |
.replace(/[^\w\s\t\n]+/, '') | |
.split(' '); | |
for( var i in text ){ | |
if( words[ text[i] ] == undefined ) | |
words[ text[i] ] = 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
!function( ytplayer ){ | |
var url = ytplayer.config.args["url_encoded_fmt_stream_map"], | |
videoFormats = url.split(','), | |
videos = [], | |
props = ['quality', 'type']; | |
setFormats(); | |
askToUser(); |
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
{ | |
"estados": [ | |
{ | |
"sigla": "AC", | |
"nome": "Acre", | |
"cidades": [ | |
"Acrelândia", | |
"Assis Brasil", | |
"Brasiléia", | |
"Bujari", |
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
var key = 'heuehueheubrbrbrprasswithlasers333'; | |
/* | |
* Simple Encrypt-Decrypt Algorithm | |
* mode = 1 or -1 | |
* 1 -> Encrypt mode | |
* -1 -> Decrypt mode | |
*/ | |
function simpleED( str, mode ){ |
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
module Analiser | |
extend self | |
def parse(text) | |
originalArray = text.split(/\s/).reject {|x| x.empty?} | |
repeatedWords = {} | |
originalArray.each do |word| | |
word.downcase! | |
if repeatedWords.has_key?(word.to_sym) |
OlderNewer