Personal RescueTime (Computer activity time tracker)

I have been a paid user of RescueTime every month since June 2015, but since I love collecting and analyzing data, I decided to replicate the functionality and keep track of the data in my own local database. Using applescript and postgresql, I’ve been recording computer usage (application name and window title) since “2017-12-08 20:06:00.670021”. I was just completing a survey on Coursera, which is asking “How many hours per week do you plan to spend working on this course?”, and because I started recording data on December 8th and started taking the class on the 6th, I knew I had data for the majority of my coursera time. This doesn’t account for course-related material that wasn’t on coursera’s website or didn’t have “Coursera” in the title, and now I’m also realizing I should try to grab a url of the current application I’m in, if I can (unfortunately, some quick google searches don’t return anything obvious for firefox, although chrome does have it built in..).


with base as (
    select
            *
            , datetime-lag(datetime) over (partition by true order by datetime) as time_between
            , extract(year from datetime)::text||'-'||extract(week from datetime)::text as week
        from user_activities
        where (window_name ilike '%coursera%')
            or (application ilike '%firefox%' and (
                window_name ilike '%week+%'
                or window_name ilike '%assignment%'))
        order by datetime
    ) , filtered as (
        select *
        from base
        where time_between<'15 minutes'::interval
    )
    select
        week
        , sum(time_between) as time_spent_on_coursera
    from filtered
    group by week
    order by week
;
week   | time_spent_on_coursera
---------+------------------------
 2017-49 | 00:48:47.559574
 2017-50 | 09:45:30.929945
 2017-51 | 04:02:11.548172
(3 rows)

Note that for week 2017-50, that's 9 hours and 45 minutes. If anyone is interested, I could come back and explain this a bit. It's not completely accurate, because Coursera refers to some materials that don't have "coursera" in the title, and I could have been busy doing something non-coursera-related for less than 15 minutes, which would make it less accurate.

I recommend RescueTime, as it is an awesome tool for finding out a quantitative truth about where you spend your time on the computer: https://www.rescuetime.com

Useful bash commands

Remove the last 1 line of output:

printf "1\n2\n3\n4\n5\n" | head -n-1
1
2
3
4

without ” | head -n-1″, the printf command yeilds:

printf "1\n2\n3\n4\n5\n"
1
2
3
4
5

Remove the first 1 line of output:

printf "1\n2\n3\n4\n5\n" | tail -n+2
2
3
4
5

You can change the number in any command you like. tail -n+1 doesn’t seem to remove any lines, so add 1 to whatever number of lines you want to remove.

Coffee Notes

Forager (in San Jose) opened late February 2017.

Devout Coffee brand, San Sebastian beans – from Guatemala, natural process.


Coffee Classes at Chocolate Fish Coffee Roasters in Sacramento at 4749 Folsom Boulevard, East Sacramento.

Coffee books/authors:

2017-12-18
In coffees I look for fruity flavors. Usually when coffee people say they taste specific fruit flavors like nectarine, strawberries, etc, I don’t usually taste it. The only kind-of fruit flavor I have ever really been able to taste in a coffee was blueberries in a coffee from Ethiopia (unfortunately, I don’t remember which one specifically).

The best coffee I’ve ever had was Guji Highland by Devout, but unfortunately, its season is over. I don’t know whether it will have another season in the future. Forager Tasting Room and Eatery in Downtown San Jose uses their beans, but I’m not sure if they sell whole beans. Another really good coffee I’m having lately is San Sebastian, also by Devout. Other good coffee bean producers are Verve (Santa Cruz) and Temple (Sacramento). I haven’t enjoyed any coffees from Allegro, which is too bad, because Whole Foods carries a lot of their beans. Starbucks coffees mostly taste like burnt coal, and Philz Coffee “Lighter Blend” “Sooo Good” also tastes burnt.

Raspberry Pi plot of temperature/humidity/pressure data

Improvements to be made:

  • convert x axis to utc time and make ticks at every hour or every few hours
  • add: light intensity sensor (for sun), rain gauge, wind direction/speed
  • move the temperature sensor out of sunlight to reduce effects from radiant heat, and move it farther away from the window to reduce influence from indoor temperature
  • put pressure on its own axis so it doesn’t need to be divided
  • add units to everything (pressure is in hPa)
  • list everything it took to build my setup

Parts

Raspberry Pi 3

MCM Electronics Raspberry Pi 3 Project Kit with GPIO Breakout, Breadboard and Components (On Amazon, which reports it for about $87.99, but it was at Fry’s for $82.99). This is a great starter kit, but is unsupported. The company that made it, MCM Electronics, was apparently bought or merged, and whoever is now in control chose to no longer support the users of this kit, because the starter guide that a piece of paper in the kit refers to doesn’t exist anywhere on MCM’s website (or anywhere on the internet; I searched for at least 20 minutes to no avail).

Humidity/Temperature Sensor

On Adafruit.com

Pressure sensor

On ControlEverything.com

Waterproof temperature sensors

Vktech 5pcs 2M Waterproof Digital Temperature Temp Sensor Probe DS18b20, on Amazon.


A great tutorial of how to use the temperature sensors: https://www.jeremymorgan.com/tutorials/raspberry-pi/monitor-room-temperature-raspberry-pi/

Where to find more Raspberry-Pi-like computers: https://www.digikey.com/products/en/development-boards-kits-programmers/evaluation-boards-embedded-mcu-dsp/786. I haven’t looked through it thoroughly, but my brother told me about it. Raspberry Pi seems to be the one that gets the press and is made as a starter kit for beginners, and possibly even started the idea (don’t quote me on that; this is just speculation).

My LinkedIn profile links to this page: https://www.linkedin.com/in/mica-eldridge-510339b9

iPhone: Silence an incoming call without letting the caller know

I get a lot of spam calls, but want to silence the ringer without tipping the caller off that I did it. If you want to make an incoming call stop ringing without answering or letting the caller know you hung up, then press one of the volume buttons. If you press the menu button, power button, or on-screen “Decline” button, then the caller will immediately be sent to voicemail (or whatever is in its place), and if it happens soon enough after they dialed you, they will know that you intentionally declined their call. If you use one of the sound buttons, then the caller will continue ringing, but your phone will stop making the ringing sound.

Firefox Tips

from 2017-09-03:

My Firefox was bogged down for at least a year, but ever since I created a new profile, it’s super speedy! Sometimes I have to quit Firefox and reload the old profile (which is painfully slow) to grab a bookmark, but other than that, it’s been great to have Firefox be more responsive again. Follow the instructions at https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles#w_starting-the-profile-manager to read about managing multiple profiles.

At some point, on Mac, Firefox’s “highlight all” hotkey changed from ctrl-a to cmd-enter and cmd-L.

Firefox can be made to “highlight all” by default when searching: https://superuser.com/a/642824/329095

How to re-enable postfix in Mac ~10.12

At some point, my postfix stopped sending messages. I need to be able to receive mail on the command line on my machine.

I suspect one of these two events caused the change:
migration to a new mac computer using migration assistant from a time machine
updating to 10.12.6 (mainly a security update).

Warning: don’t use sudo or copy-paste commands from the internet unless you know what you’re doing. also always check what you copy by first pasting in a plaintext editor and reviewing that it’s the same as what you copied – javascript code on webpages can potentially modify your clipboard after you copy text, and they could put code in your clipboard that could potentially install malware/spyware/viruses/etc.

I discovered the issue using:
`echo stuff | sendmail user@localhost`
(you can replace “user” with your username)
and got this message:
unknown: fatal: file /etc/postfix/main.cf: parameter mail_owner: user postfix has same user ID as _postfix

first:
`cd /etc/postfix`
`less /etc/postfix/main.cf`
empty file. I’m guessing it used to have stuff in it. my first instinct was to go to my time machine and see old versions, but I decided to `ls` to see what’s available.

I was able to tell that these two files were the same:
`diff -u main.cf.default~orig main.cf~orig`
(no output)

so I copied one of them to main.cf (main.cf is the file mentioned in the error message):
`sudo cp main.cf.default~orig main.cf`

and I was able to send and receive mail again. first to send:
`echo stuff | sendmail user@localhost`
then to receive:
`mail`

NOTE: I’m sure there’s a reason apple disabled postfix (i.e. security). most people don’t need it. only do this if you need it.

 

Also, in order to receive mail for the root user, follow this tutorial: https://topicdesk.com/faqs/os-x-server-mail-services/how-can-i-deliver-mail-for-the-root-user/

If you experience these symptoms, see a doctor

Bad things still happen to people, even in this time of incredible technology and medicine. If you want to preserve your life, you need to listen to your body and know when it’s time to act on symptoms. I put my health above most other things in my life, because I think that if I die, I lose my ability to act in this world. I also want to preserve my sensors (eyesight, hearing, sense of touch, etc.) so I can continue to sense the world as fully as I currently can, and preserve my actuators (legs, arms, hands, fingers, etc.) so I can continue to act in the world at least as fully as I currently can.

In this particular case, a man died from a tooth infection in 2011. His wisdom tooth starting hurting but he forwent a tooth-pull surgery because he had neither a job nor health insurance. His wisdom tooth got worse (either became infected or an existing infection spread) until he ended up in the emergency room. “[H]e received prescriptions for antibiotics and pain medications. Willis couldn’t afford both, so he chose the pain medications.” The tooth infection spread to his brain and he died. The article says that this has happened to people in the past, which indicates that this may have happened often and may still be happening today.

In that situation, I would have gotten the tooth pulled as soon as a dentist told me that’s what I needed, even if I might be paying debt for some years to come.

In another case, a man had a lingering headache. OTC pain relievers didn’t help and his eyes became sensitive to light, and he dismissed it as a migraine for a week before his girlfriend insisted that he go to a doctor. He’s a salesman for a major pharmaceutical company, so he searched the internet and decided he knew what was wrong and what kind of drug he needed. He went to a walk-in clinic, and a doctor sent him to an opthalmologist (he was wrong about the diagnosis and treatment). The opthalmologist referred him to a neuro-opthalmologist, of which there are about 500 in the US. He has a very special problem to need such a rare specialist, and he had dismissed it as a migraine. After testing, they discovered that he has Neuromyelitis optica (“Devic’s syndrome”), which is a rare autoimmune disease. “There are an estimated 4,000 cases of NMO in the United States…”

Pain is your body’s way of telling you that something is wrong. If I have a mild headache for one day, I’ll just wait it out. If I have a mild headache that lasts more than two days, I’ll make a doctor’s appointment. If I have a similar mild headache accompanied by the symptoms of a cold (rhinovirus) for two days, no doctor. If I have an extreme headache that lasts more than 2 hours and then tapers off, I’ll make a doctor’s appointment to get tested for an underlying problem. If I have a similar extreme headache but it lasts more than 2 hours and OTC pain-relievers don’t help, I’ll go to the emergency room. If I were alone and couldn’t get myself to the emergency room and thought I would die without help, I would call 911. If I thought I might not die but I’m not sure, I’d call an advice nurse, but if I didn’t have an advice nurse available, I’d still at least go to the emergency room (“better safe than sorry”).

You may have access to more health support than you’re aware of. I suggest you find out what services you have access to before an emergency situation occurs. Your local municipality may provide low-cost or no-cost health support. If you can’t afford medical procedures or health insurance, fees may be reduced or waived. At least some colleges provide on-call advice nurse services to their students.

Listen to your body. Don’t self-diagnose, and don’t dismiss. The internet isn’t a substitute for the educated opinions of medical professionals. Some people think doctors don’t know much, but I doubt many of the people who think that know more than doctors know.