Skip to content

Instantly share code, notes, and snippets.

@tim-fan
tim-fan / country_entry_history.py
Last active August 5, 2024 20:06
Determine country entry/exit history using google location history
"""
For a visa application, I need to provide a list of all countries I've visited in the past 10
years, along with the associated entry/exit dates.
This is a pain as I've visited 37 countries in that timeframe.
This script parses Google location history to provide a list of countries visited along with entry/exit dates.
Usage:
1) Download and unzip timeline history from https://takeout.google.com/
@tim-fan
tim-fan / locations_of_interest.csv
Last active October 9, 2021 22:36
All locations of interest for NZ August '21 Delta Outbreak as at 8/10/21. Includes locations deleted from source https://github.com/minhealthnz/nz-covid-data.git
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
,id,Event,Location,City,Start,End,Advice,LAT,LNG,Added,Updated,source_sha1,check,Information
0,a0l4a0000004EOW,Star and Garter Hotel Coromandel,"5 Kapanga Road, Coromandel 3506",Coromandel,2021-08-13 18:39:00,2021-08-13 19:40:00,"Isolate at home for 14 days from date of last exposure. Test immediately, and on days 5 & 12 after last exposure. Call Healthline for what to do next.",-36.760007,175.49723799999998,2021-08-13 18:39:00,2021-08-13 18:39:00,1560942d9537ba83510a3206f4841c1bf811f4fa,,
1,a0l4a0000004EOX,Umu Cafe Coromandel,"22 Wharf Road, Coromandel 3506",Coromandel,2021-08-13 19:40:00,2021-08-13 20:30:00,"Isolate at home for 14 days from date of last exposure. Test immediately, and on days 5 & 12 after last exposure. Call Healthline for what to do next.",-36.760098,175.497078,2021-08-13 19:40:00,2021-08-13 19:40:00,1560942d9537ba83510a3206f4841c1bf811f4fa,,
2,a0l4a0000004EPA,Jaks Cafe & Bar Coromandel,"104 Kapanga Road, Coromandel 3506",Coromandel,2021-08-14 10:50:00,2021-08-14 11:30:00,"Isolate at home
@tim-fan
tim-fan / location_of_interest_animation.py
Last active October 31, 2021 11:28
Animated map of New Zealand's August 2021 Covid outbreak locations of interest over time
from pathlib import Path
from git import Repo
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
import dateutil.parser as dateparser
import plotly.express as px
# # requirements.txt:
# gitpython
@tim-fan
tim-fan / install_prefered_apt_pkgs.sh
Last active September 28, 2024 14:52
Script to install a collection of apt packages I like to have available
#!/bin/bash
# script to install apt packages that I like to have available on an ubuntu machine
# to install straight from github:
# curl https://gist.githubusercontent.com/tim-fan/8819805d8e429308618e33a99d4ec39a/raw/install_prefered_apt_pkgs.sh | sudo bash
apt install -y \
bash-completion \
@tim-fan
tim-fan / dnn_dockerfile
Created August 2, 2020 11:06
Dockerfile to build dnn_detect for ROS noetic https://github.com/UbiquityRobotics/dnn_detect
# adapted from https://github.com/SteveMacenski/slam_toolbox/blob/noetic-devel/Dockerfile
FROM ros:noetic-ros-base-focal
# USE BASH
SHELL ["/bin/bash", "-c"]
# RUN LINE BELOW TO REMOVE debconf ERRORS (MUST RUN BEFORE ANY apt-get CALLS)
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
@tim-fan
tim-fan / realsense_spencer.launch
Created February 22, 2019 08:37
ROS launch file for running spencer people tracking using the Realsense D435i camera
<launch>
<include file="$(find realsense2_camera)/launch/rs_rgbd.launch">
<arg name="camera" value="/spencer/sensors/rgbd_front_top"/>
<arg name="tf_prefix" value="rgbd_front_top"/>
</include>
<node pkg="realsense_spencer_adaptor" type="realsense_spencer_adaptor.py" name="realsense_spencer_adaptor" ns="/spencer/sensors/rgbd_front_top"/>
<include file="$(find spencer_people_tracking_launch)/launch/tracking_single_rgbd_sensor.launch">
@tim-fan
tim-fan / realsense_spencer_adaptor.py
Created February 22, 2019 08:16
ROS node for running spencer_people_tracking using a Realsense D435i camera
#!/usr/bin/env python
#realsense_spencer_adaptor.py
# node for connecting realsence d435i output to spencer tracking package
import rospy
import cv_bridge
import cv2
from sensor_msgs.msg import Image
@tim-fan
tim-fan / realsense_rovio_adaptor.py
Created February 11, 2019 09:07
Ros node for running Rovio from output of realsense driver
#!/usr/bin/env python
#ROS node to adapt output of realsense camera driver (testing with D435i)
#to be used for input to Rovio
#
# Specifically, the node resolves two issues:
#
# 1) The realsense driver publishes images with encoding set as "8UC1"
# This leads to the following error in Rovio:
# "CvBridgeError: [8UC1] is not a color format. but [mono8] is"
@tim-fan
tim-fan / regressionModelsProjectReport.Rmd
Created March 4, 2018 07:25
Project report for Coursera course 'Regression Models', March 2018
---
title: 'Regression Models Project: mtcars'
author: "Tim F"
date: "4 March 2018"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set()
@tim-fan
tim-fan / plotOnzos.py
Created February 25, 2018 08:12
Plot Onzo bike locations on google maps
#script to plot onzo bike locations on google maps.
#After running, open onzoMap.html to view map.
#ToDo: Add overlay of bike info: charge level, times used, id, etc.
import pandas as pd
import gmplot
import requests
apiUrl = 'https://app.onzo.co.nz/nearby/-36.848123/174.765588/50.0'
response = requests.get(apiUrl)