{"action":"closed","issue":{"url":"https://api.github.com/repos/vagrant-php/ubuntu/issues/3","labels_url":"https://api.github.com/repos/vagrant-php/ubuntu/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/vagrant-php/ubuntu/issues/3/comments","events_url":"https://api.github.com/repos/vagrant-php/ubuntu/issues/3/events","html_url":"https://github.com/vagrant-php/ubuntu/issues/3","id":116270685,"number":3,"title":"Intelligent fallback for cpu and memory","user":{"login":"scuben","id":922919,"avatar_url":"https://avatars.githubusercontent.com/u/922919?v=3","gravatar_id":"","url":"https://api.github.com/users/scuben","html_url":"https://github.com/scuben","followers_url":"https://api.github.com/users/scuben/followers","following_url":"https://api.github.com/users/scuben/following{/other_user}","gists_url":"https://api.github.com/users/scuben/gists{/gist_id}","starred_url":"https://api.github.com/users/scuben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scuben/subscriptions","organizations_url":"https://api.github.com/users/scuben/orgs","repos_url":"https://api.github.com/users/scuben/repos","events_url":"https://api.github.com/users/scuben/events{/privacy}","received_events_url":"https://api.github.com/users/scuben/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-11T05:50:15Z","updated_at":"2015-11-26T20:23:31Z","closed_at":"2015-11-26T20:23:31Z","body":"I used to use the following script to determine the number of cpus and memory. This \"could\" be used as a fallback but is open for discussion.\r\n\r\n    # Give VM 1/4 system memory & access to all cpu cores on the host\r\n    if host =~ /darwin/\r\n      cpus = `sysctl -n hw.ncpu`.to_i\r\n      # sysctl returns Bytes and we need to convert to MB\r\n      mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4\r\n    elsif host =~ /linux/\r\n      cpus = `nproc`.to_i\r\n      # meminfo shows KB and we need to convert to MB\r\n      mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4\r\n    else\r\n      # sorry Windows folks, I can't help you\r\n      cpus = 2\r\n      mem = 1024\r\n    end"}}