4 ms·
Not going to SXSW, but... tr ',' '\n' | sort -n | uniq -d
by zdw 16y ago
Not going to SXSW, but...
tr ',' '\n' | sort -n | uniq -d
- RodgerTheGreat 16y agoIt's also pretty easy to do in Excel, favored tool of "marketing gurus". Find/replace, import, pivot.
- josegonzalez 16y agoI actually found a solution for it in excel before writing the following: asort($data); $duplicate = function ($val) use (&$data) { $count = 0; foreach ($data as $i => $entry) if ($val == $entry) $count++; return $count; }; foreach ($data as $v) if (($count = $duplicate($v)) > 1) { printf("%d, Count %d\n", $v, $count); break; } I assume it would be possible to use a sort+callback to return the value as well.
- jeresig 16y agosort + callback is what I did in JavaScript: .sort(function(a,b){if(a==b){throw a;}return a-b;});
- josegonzalez 16y agoDid you eval the dom to get the dataset?
- false 16y agoI did :) JSON.parse(p.innerHTML.split('\n')[2])
- zdw 16y agoThe point was posting a hack. "most" people don't know unix shell. I'd consider your mention of Excel to be a hack, as I honestly don't have a clue with it beyond the basics.
- deleted 16y ago[deleted]
- y0ghur7_xxx 16y agox = File.read('puzle.txt') y = x.split(/ \w /) module Enumerable def dups inject({}) {|h,v| h[v]=h[v].to_i+1; h}.reject{|k,v| v==1}.keys end end d = y.dups require 'mathn' dp = [] d.each {|z| z = z.to_i; dp << z if z.prime?} dp