   end
 
   defp format_memory(memory, coefficient), do: "#{memory / coefficient} GB"
-
-  defp linux_cmd(file, regex) do
-    Regex.run(regex, system_cmd("cat", [file]))
-  end
 
   defp system_cmd(cmd, args) do
     {output, exit_code} = System.cmd(cmd, args)

  """
  def cpu_speed, do: cpu_speed(os())

  defp cpu_speed(:Windows), do: "N/A"
  defp cpu_speed(:macOS), do: system_cmd("sysctl", ["-n", "machdep.cpu.brand_string"])
  defp cpu_speed(:Linux) do
    ["model name\t:" <> cpu_info] = linux_cmd("/proc/cpuinfo", ~r/model name.*:[\w \(\)\-\@\.]*ghz/i)
    String.trim(cpu_info)
  end


  """
  def available_memory, do: available_memory(os())

  defp available_memory(:Windows) do
    parse_memory_for(
      :Windows,
      system_cmd("WMIC", ["COMPUTERSYSTEM", "GET", "TOTALPHYSICALMEMORY"])
    )
  end
  defp available_memory(:macOS) do
    parse_memory_for(:macOS, system_cmd("sysctl", ["-n", "hw.memsize"]))
  end
  defp available_memory(:Linux) do
    parse_memory_for(:Linux, system_cmd("cat", ["/proc/meminfo"]))
  end

  defp parse_memory_for(_, "N/A"), do: "N/A"
  defp parse_memory_for(:Windows, raw_output) do
    [memory] = Regex.run(~r/\d+/, raw_output)
    {memory, _} = Integer.parse(memory)
    format_memory(memory, 1_000_000_000)
  end
  defp parse_memory_for(:macOS, raw_output) do
    {memory, _} = Integer.parse(raw_output)
    format_memory(memory, 1_000_000_000)
  end
  defp parse_memory_for(:Linux, raw_output) do
    ["MemTotal:" <> memory] = Regex.run(~r/MemTotal.*kB/, raw_output)
    {memory, _} = memory
                  |> String.trim()
                  |> String.trim_trailing(" kB")
