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:

References

  1. http://informhealth.com/neurotrophins-fertilisers-for-your-brain/
  2. http://www.health.com/heart-disease/how-many-steps-a-day-prevent-heart-disease
  3. https://edition.cnn.com/2017/07/05/health/hunter-gatherer-diet-tanzania-the-conversation/index.html
  4. https://www.theguardian.com/science/2013/sep/22/dieting-disaster-evolution-daniel-lieberman
  5. https://www.selfhacked.com/blog/avoiding-sun-will-kill-14-proven-science-based-health-benefits-sun
  6. https://greatergood.berkeley.edu/article/item/how_nature_makes_you_kinder_happier_more_creative
  7. https://www.psychologytoday.com/blog/freedom-learn/201105/the-human-nature-teaching-ii-what-can-we-learn-hunter-gatherers
  8. https://www.theguardian.com/technology/2010/mar/14/my-bright-idea-robin-dunbar
  9. http://www.cracked.com/article_14990_what-monkeysphere.html
  10. http://www.greenhighfive.com/did-we-evolve-to-be-minimalist
  11. https://www.health.harvard.edu/staying-healthy/blue-light-has-a-dark-side

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 Medium.com

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:

wget https://gist.githubusercontent.com/mr-pj/75297864abef5c8f2d5c134be2656023/raw/adc4de046c8972243eb322a6137d508da9c80372/dashbutton.py

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/dashbutton.py

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/dashbutton.py

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
done

# Network connection now exists: run Dash listener
# Change /home/pi/dashbutton.py to the path you copied the script to
# Send errors to rclocal.log <-- Useful for debugging sudo /usr/bin/python /home/pi/dashbutton.py 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 dashbutton.py 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/dashbutton.py /home/pi/rclocal.log
root      2499  0.0  1.8   8904  6924 ?        S    May21   0:00  \_ /usr/bin/python /home/pi/dashbutton.py /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: http://jacobsalmela.com/instant-raspberry-pi-ad-blocker/

Make sure you assign a static IP to your Raspberry Pi: http://www.modmypi.com/blog/tutorial-how-to-give-your-raspberry-pi-a-static-ip-address

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: http://ads-blocker.com/testing.
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 192.168.0.69 with YOUR Raspberry Pi’s static IP:

#!/bin/bash
# Use the DNS server hosted on my Raspberry Pi
networksetup -setdnsservers Wi-Fi 192.168.0.69

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 ‘Block-ads.app’

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 www.iconfinder.com makes this simple. I found a nice free Raspberry Pi 128×128 PNG icon – https://www.iconfinder.com/icons/386490/raspberry_icon#size=128

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: https://www.iconfinder.com/icons/386450/apple_ios_icon#size=128

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