Nathan's Blog

Web development and useful information

Nathan's Blog

Category: Useful Information Page 1 of 2

Health, Happiness and Hunter-Gatherers

Exercise and a good diet is healthier for you than being sedentary and eating junk food. Why though?

Is there a model of health that can explain why exercise and a good diet is healthy? Can this model predict other activities that promote health and happiness? One model that accurately predicts healthy activities is living like a hunter-gatherer.

Our bodies evolved over millions of years where hunting and gathering was the dominant way of life.

Two million years is a lot of time for evolution to reward the activities that helped us survive and reproduce. Eating food is an essential activity for our survival. The way we got food in the past is a lot different to how we get it today.

Three ways we got food:

  1. Hunting and gathering
  2. Agriculture
  3. Agriculture & Technology <-- today

A timeline from this blog that shows just how long we were doing this hunting and gathering thing.

Hunting and gathering was humanity’s first and most successful adaptation, occupying at least 94% of human history.

There is evidence of our ancestors hunting and gathering as far back as 2 million years ago. When we (homo sapiens) appeared 200,000 years ago hunting and gathering was still the dominant way of life. It stopped being the dominant way of life around 12,000 years ago with the move to agriculture.

I’m using 120 years ago as the introduction of refined processed foods, enabled by improvements in technology.

If we include our ancestors:
Hunting and gathering = 99.4%
Agriculture = 0.6%
Technology = 0.00006%

If we only include humans (homo sapiens):
Hunting and gathering = 94.3%
Agriculture = 5.7%
Technology = 0.0006%

That’s a lot of time to adapt us to hunting and gathering!

Here are some examples of health advice, and how they match those hunter-gatherer activities that lead to survival and reproduction:

  • Exercise. It boosts physical strength, makes you happy, lose weight, increases your energy levels, improves brain function, memory and sleep (1)
    It was beneficial for hunter-gathers to be at their best while finding food. Exercise is analogous to hunting and foraging… here, have some BDNF to improve your brain function for the hunt. Exercise use to happen naturally. It was tied to our survival.
  • Walk 10,000-15,000 steps per day (2)
    Same thing. Hunter-gatherers walked and hunted for food. Their survival depended on being active.
  • Intermittent fasting(2)
    It increases BDNF and attention. I’m going to give your brain a boost to give you the best chance to find food.
  • Eat fruit, vegetables, small amounts of lean protein and fish (3)
    Hunter-gather diet.
  • Avoid processed foods, added sugar and bad fats (4)
    Our bodies are not adapted to eating lots of added sugar, fat and processed food. We feel good when we eat these things because it used to be hard to find calorie dense foods like honey. When we did we were rewarded with a surge of dopamine (survival and reproduction neurotransmitter). Energy dense foods are good for survival.
    Today you can easily get these dopamine hits because sugar and fat is everywhere, and cheap!
  • Sun exposure produces vitamin D, lowers cortisol, increases serotonin and dopamine (5)
    Hunting and foraging in the sun.
  • Being in nature makes you happier and more creative (6) 
    Hunter-gatherer life.
  • We learn best through trial and error (7)
    Hunter-gatherer learning is practical.
  • We are social animals and feel happy when we help each other (8)(9)
    We are adapted to live in close communities of about 150, as our hunter-gather ancestors did.
  • Minimalism (10)
    Hunter-gatherers were nomadic. They moved where the food was.
    They could not carry a child, a 60″ TV, two wardrobes of clothes etc. Could be why we feel free when we own less stuff.
  • Sleep (11)
    Before the invention of artificial light – which suppresses the sleep hormone melatonin – we were more likely to get better sleep.

That we’re born with Hunter-gatherer bodies into an environment that’s so different to the one we’re adapted to explains today’s mismatch diseases.

Two great books on the subject if you want to know more:



Dash Button with Raspberry Pi

I set up my Raspberry Pi to listen for Amazon Dash Button presses recently.
Raspberry Pis are excellent devices for monitoring Dash button presses because they use very little electricity, so can be left running.

I spent some time getting it working so I’m adding the steps I took here.

1. The easiest way to get a Dash button’s MAC address:
Follow the steps in this post to find your Dash button’s MAC address.

View story at

2. Install the required dependencies:

# Update your software
sudo apt-get update && sudo apt-get upgrade

# Install pydhcplib
sudo apt-get install python-pip
sudo pip install pydhcplib

3. Copy this script to your Raspberry Pi
The easiest way is to use wget:


Here’s the script:

4. Replace the script’s MAC address with yours

# Replace "50:f4:de:f1:3b:a0" with the MAC address you found in step 1
# It needs to be lowercase, with a colon after every two characters
dashbuttons.register("50:f4:de:f1:3b:a0", do_something)

5. Make your Python script executable

sudo chmod +x /home/pi/

7. Test the script
Your Python script should now be able to detect your Amazon Dash button presses. Test the Python script by running:

sudo python /home/pi/

Press your button and you should see the message, “button has been pressed”.

8. Update the do_something function to make it do something useful
I’m using mine to track toilet roll changes. When I get down to two or less I send an email reminder.
I’m using another Dash button as a “digital habit tracker”.
I’m logging morning Meditation to a habits.txt text file on my Raspberry Pi. I’ve ordered four more to track other habits.

Analogue is so trendy.

Other uses for your Dash button:
Order pizza
Wireless doorbell
Control smart lights
Send a text
Track baby data
Track practice sessions

8. Set the Python script to run on startup

Edit /etc/rc.local

sudo vim /etc/rc.local

Add the following to the end of /etc/rc.local (before exit 0

# Wait for an Internet connection
# If you connect using an Ethernet cable, change 'wlan0' to 'eth0'
while ! /sbin/ifconfig wlan0 | grep -q 'inet addr:[0-9]'; do
    sleep 3

# Network connection now exists: run Dash listener
# Change /home/pi/ to the path you copied the script to
# Send errors to rclocal.log <-- Useful for debugging sudo /usr/bin/python /home/pi/ 2>&1 /home/pi/rclocal.log &

# Make sure exit 0 is the last line of rclocal
exit 0

9. Reboot and test your script

sudo shutdown -r now

You should have the process running in the background, listening for presses.
To verify your Python script is running type:

ps wafux | grep dash

You should see something like:

root      2490  0.0  0.6   3756  2296 ?        S    May21   0:00 sudo /usr/bin/python /home/pi/ /home/pi/rclocal.log
root      2499  0.0  1.8   8904  6924 ?        S    May21   0:00  \_ /usr/bin/python /home/pi/ /home/pi/rclocal.log

This means the Python script is running and listening for your presses.

Easy DNS switching on OS X

I’m currently using my Raspberry Pi B+ as an ad-blocker. It works great.

Install Ad-blocker on your Raspberry Pi

If you have an up-to-date Raspberry Pi running Raspbian, you can install this by running a single command, here:

Make sure you assign a static IP to your Raspberry Pi:

By default your Pi will be assigned a dynamic IP by your router. Assigning a static IP means you can connect using the same IP address every time, and setup easy DNS switching below.

Point your DNS server to your Raspberry Pi

To use your new Ad-blocker, set your DNS server to the static IP of your Raspberry Pi.
In this example I’m using OS X.
Changing your DNS in OS X is done by opening System Preferences > Network > Advanced > DNS and setting the static IP here.

Set DNS server on OS X

Try it out

Your Raspberry Pi ad-blocker should now be working. You can test if it’s working by visiting this URL:
If you don’t see ads on the page, it’s working.

Disabling Ad-blocking

I ran into an issue using my Raspberry Pi ad-blocker where clicking sponsored Google Ads in search results does not redirect to the link.
I wondered if there was an easier way to switch back to my default DNS server in OS X, than manually changing it in System Preferences.

Enter OS X’s Automator. It comes with OS X.

Easy DNS switching on OS X using Automator

1. Open Automator

2. Choose the ‘Application’ type

Automator - Application Type

3. Type ‘Shell’ into the filter to find the ‘Run Shell Script’ action. Double-click it to open the action in the right hand pane.

Screenshot 2015-03-29 19.07.23

4. Copy and paste this shell script, replacing with YOUR Raspberry Pi’s static IP:

# Use the DNS server hosted on my Raspberry Pi
networksetup -setdnsservers Wi-Fi

Automator - Run Shell Script

Note: If you use an Ethernet cable instead, change Wi-Fi above to Built-in Ethernet. I can’t bring myself to buy the £25 Thunderbolt to Ethernet adapter so I use Wi-Fi.

If you connect another way, you can find a list of all the network services on the server’s hardware ports by typing:

networksetup -listallnetworkservices

Change Wi-Fi to the network service you use to connect to the Internet.

5. Save and choose a name for your app, something like ‘’

6. By default, your app will have the Automator icon. If you’d like to change the icon that’s easily done. All you need is to find a 128×128 PNG.

Default automator icon

7. Using the excellent makes this simple. I found a nice free Raspberry Pi 128×128 PNG icon –

8. Download the PNG to your computer, open it in ‘Preview’ and copy the icon using ⌘C.

9. Right click your app’s icon and select ‘Get Info’. Click on the current Automator icon in the top left.

Change icon

10. Press ⌘V to change the icon to the icon in your clipboard

Screenshot 2015-03-29 18.33.38

You can now use this app to easily turn ad-blocking on.
It will prompt for your password when you run it.

11. To create your ‘Show ads’ app, repeat the above steps and change the DNS server to your default DNS server address.

For my ‘Show ads’ app I used this icon:

Icon Downloads

Download Raspberry Pi icon (block ads) – 128×128 PNG
Download Apple icon – (show ads) 128×128 PNG

Page 1 of 2

Powered by WordPress & Theme by Anders Norén