Posts about technology

Updating Google Chrome on MacOSX is broken!

24 January 2015

Or am i the only one who could never, ever, update Google Chrome through the "About" box?

Everytime i press "Update" here:

I get this:

Anyone knows if there a solution to this?

Count (group by) number of line occurrences in file

24 January 2015

Here's a neat ruby script to group and count the number of occurrences of lines inside a given file.

count.rb list = IO.readlines(ARGV[0]) h = {|hash, key| hash[key] = 0} list.each {|item| h[item] += 1} h = h.sort_by { |k,v| v }.reverse h.each_with_index do |p,i| puts "(#{p[1]}) #{p[0]}" if ARGV[1] and ARGV[1].to_i <= i + 1 break end end Usage is: ruby count.rb <file> [show_at_most_n] If you have a file named "faren.txt" comprised of the following lines: test test awesome dude dude dude faren meran Running the script  with: ruby count.rb faren.txt Will yield the following result: (3) dude (2) test (1) awesome (1) faren (1) meran In addition, if you pass the "show_at_most_n" parameter (a number), it will only print that number of results. For example 2 will show the following: (3) dude (2) test

New version of the red hot chili peppers lyrics generator

24 January 2015

This time i decided to make available online, here.

Have fun :D

Displaying posts 4 - 6 of 52 in total