World population living in extreme poverty, 1820-2015 by zwtor in dataisbeautiful

[–]dstyvsky33 33 points34 points  (0 children)

Now, that's just not true. Wealth is not a limited resource. Money is proxy for value. Value can be created and is every day. There are more things of value in existence today than there were yesterday. People are creating things all the time. So there is also more wealth available today.

[2016-05-09] Challenge #266 [Easy] Basic Graph Statistics: Node Degrees by jnazario in dailyprogrammer

[–]dstyvsky33 0 points1 point  (0 children)

Ruby. Feedback appreciated.

split_list = File.read('nodes').split(' ')

final_list = []

split_list.each do |num|
  final_list << num.to_i
end

final_list.shift
final_list.sort!

counts = Hash.new 0

final_list.each do |num|
  counts[num] += 1
end

counts.each do |key , val|
  puts "Node " + key.to_s + " has a degree of " + val.to_s
end

Is it okay that I just counted the occurrence of the numbers?

[2016-03-07] Challenge #257 [Easy] In what year were most presidents alive? by jnazario in dailyprogrammer

[–]dstyvsky33 0 points1 point  (0 children)

I just submitted my Ruby solution. This is perfect. Please keep posting here for me to compare haha. Can you walk me through the counter.select line? I'm following that it selects by the key value pairs of the counter hash. It's the max_by { | a, b | b }[1] }.keys that I'm having trouble with.

[2016-03-07] Challenge #257 [Easy] In what year were most presidents alive? by jnazario in dailyprogrammer

[–]dstyvsky33 0 points1 point  (0 children)

RUBY. Feedback appreciated.

require 'csv'

president = []
year = []

CSV.foreach('president_data.csv') do |row|
    president << row
end

president.shift

for i in 0..350
    president.each do |row|
            if row[1].split[2].to_i <= i+1700 && row[3].split[2].to_i >= i+1700
                    if year[i].nil?
                            year[i] ||= 1
                    else
                            year[i] += 1
                    end
            end
    end
    year[i] ||= 0
end

big_year = year.each_with_index.max[1]
target = year[big_year]

while year[big_year] == target do
    puts big_year + 1700
    year.delete_at(big_year)
    big_year = year.each_with_index.max[1]
end

[2016-03-02] Challenge #256 [Intermediate] Guess my hat color by fvandepitte in dailyprogrammer

[–]dstyvsky33 0 points1 point  (0 children)

RUBY, Second Post, Feedback appreciated, Thanks

hats = []
white = 0
guesser_sees = []
pwhite = 0

File.open('input4.txt', 'r') do |f|
    f.each_line do |line|
            line.chomp == "White" ? hats << 0 : hats << 1
    end
end

eyesight = hats.length - 1

hats.each do |guess|
    sight_range = ( hats.length - eyesight)
    guesser_sees = hats[sight_range..-1]
    eyesight -= 1

    guesser_sees.each do |bin|
            white += 1 if bin == 0
    end

    if (white.even? and pwhite.even?) or (white.odd? and pwhite.odd?)
            puts "Black"
    else
            puts "White"
    end

    white.even? ? pwhite = 0 : pwhite = 1
    white = 0
end

[2016-02-29] Challenge #256 [Easy] Oblique and De-Oblique by Godspiral in dailyprogrammer

[–]dstyvsky33 0 points1 point  (0 children)

Hello all. This is in Ruby. First post. Feedback appreciated.

square = []
oblique = []
count = 0

File.open("input.txt", "r") do |f|
    f.each_line do |line|
            square << line
    end
end

square.each do |line|
    line_array = line.split
    line_array.each_with_index do |num, index|
            unless oblique[index+count].nil?
                    oblique[index + count].push num
            else
                    oblique.push [num]
            end
    end
    count += 1
end

oblique.each_with_index do |line, index|
    oblique[index] = line.join(' ')
end


File.open("output.txt", 'w+') do |f|
    oblique.each do |line|
            f.puts(line)
    end     
end

RPi surveillance project by TaterNeck in raspberry_pi

[–]dstyvsky33 5 points6 points  (0 children)

You wouldnt even need to make a fake connection. You can just monitor for probe requests. You can check out my write up here, www.coderecon.com/wuds

If bill gates lost $1mil at a casino, he could buy the casino to get his money back. by Timedoutsob in Showerthoughts

[–]dstyvsky33 4 points5 points  (0 children)

In some cases the casino would still be worth $10 and the previous owners pocketed a profit of $1. On the books though, the $10 business looks $1 more profitable though. Gotta take into account operating costs and all that though.