Skip to content

Instantly share code, notes, and snippets.

View HarvsG's full-sized avatar

HarvsG

View GitHub Profile
@HarvsG
HarvsG / .travis.yml
Last active April 10, 2018 21:57 — forked from mderazon/.travis.yml
Automatic deployment to Google Cloud Functions with Travis-ci
# REQUIRES CHANGES TO LINES 37 AND 42 TO WORK FOR YOUR PROJECT
# Use Dockerized infrastructure
sudo: false
# Use node_js environnement
language: node_js
node_js:
- "6.9.1"
# Cache Gcloud SDK between commands
@HarvsG
HarvsG / UltimatePiHoleVPN.md
Last active November 28, 2023 21:03
Reminder on how I set up a kickass VPN server with PiHole and encrypted DNS

Initial setup

This is more of a note-to self, but please feel more than free to replicate it.

  1. Follow this PiHole guide:
    • But in the first command replace wget https://git.io/vpn -O openvpn-install.sh with wget https://raw.githubusercontent.com/Angristan/OpenVPN-install/master/openvpn-install.sh -O openvpn-install.sh
    • Stick with the default options unless you know better (or the guide does in the case of tun0 vs eth0)
      • Depending on your privacy concerns and the development status of FTLDNS you may want to opt out of the DNS logging options.
    • Make sure to configure iptables to reload on restart by doing sudo bash -c "iptables-save > /etc/iptables.conf" and then adding iptables-restore < /etc/iptables.conf to /etc/rc.local
  • If doing ho
@HarvsG
HarvsG / randomise.md
Last active May 17, 2018 14:37
An idea for temporary data anonymisation and analysis validation.

Dataset randomisation for more secure and robust analysis.

Handling sensitive datasets securely whilst simultaneously sharing them among teams and services is a dichotomy that many researchers have to struggle with. Whats more, developing statistical analyis code on a real dataset can bias researchers who stumble upon associations that may be by chance and not in the initial hypothesis, these spurious associations may find their way into the eventual publication. The below is an idea to help with both.

Simple English description:

  • We take a dataset, strip out unessarily identifying information, scramble all the other columns so there are no associations along the rows and use that as a dummy data set as we develop the analysis for the research project. Then when we are happy with our analysis we run it once and only once on the real, unscrambled, dataset. Alternatively, (bullet point 4) before we run the final analysis we repeatedly scramble the dataset and run the analysis on it. The results of these r
@HarvsG
HarvsG / fstab
Created April 1, 2019 14:05
sbfspot solar data pi
proc /proc proc defaults 0 0
PARTUUID=0565c605-01 /boot vfat defaults 0 2
PARTUUID=0565c605-02 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
//192.168.1.122/homes/WeatherAndSolarData/piNew /home/pi/DSmount cifs credentials=/root/.fstabcreds,nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=1,vers=3.0 0
@HarvsG
HarvsG / SolarDataPi.md
Last active June 22, 2020 12:32
How to set up the solar data pi

SBFspot

How to set up a raspberry pi to retrieve data from an SMA inverter over the network using SBFspot and its one line installer, upload the result to PVoutput and run periodical backups to a network share.

Set up SBF spot

  1. Flash an SD with the reccomended Lite Distro for raspberry pi, in this case Stretch Lite
  2. Add an empty file called ssh to the boot partition of the SD
  3. Boot the raspberry pi and wait
  4. Find the raspberry pi's IP address in the router at 192.168.1.1, also find the IP of the Inverter
  5. Assign it a static ip adress, in my case 192.168.1.125
@HarvsG
HarvsG / ThickPi.md
Last active September 15, 2019 14:25

Ideas for network booting raspberry Pis

  1. Configure an iSCSI target on a Pi
    • install ubuntu server https://ubuntu.com/download/iot/raspberry-pi-2-3 using belena etcher
    • log in via ssh user:ubuntu pw:ubuntu - enabled by default on ubuntu server. change password
    • sudo apt update && sudo apt upgrade -y
    • sudo su
    • sudo apt -y install targetcli-fb
    • plug in s usb drive and as su fdisk -l
    • fdisk /dev/sda then commands d to delete current parition n to start new, then keep defaults. Then exit with w
@HarvsG
HarvsG / PiServer.md
Last active September 30, 2020 03:22
A method to develop a server that allows you to run your Pis SD-less and switch easily between projects

Based on this hands-on

  1. Install piserver on a debian or ubuntu system from source using the tutorial there
    • sudo apt-get install build-essential devscripts debhelper cmake libldap2-dev libgtkmm-3.0-dev libarchive-dev libcurl4-openssl-dev intltool git binfmt-support qemu-user-static
    • git clone --depth 1 https://github.com/raspberrypi/piserver.git
    • cd piserver
    • debuild -uc -us
    • cd ..
    • sudo dpkg -i piserver*.deb
  • If dnsmasq -v is <2.77 then you will need to update it (see link above)
@HarvsG
HarvsG / CurrentCostMeter.md
Last active August 28, 2024 08:47
Getting Load data from current cost energy meter.

You will need:

  • Raspberry pi - any generation will do, RPI Zero with GPIO would suffice.
  • A current cost Envi or Envir Smart Meter
  • And old ethernet patch cord
  • Some method to connect wires to the GPIO pins on the pi (solder, caps, bread-board or nothing at all)
  • contrary to a lot of information you do not need a USB to serial adapter or a current cost data cable

Software that we will be using

No need to download yet

@HarvsG
HarvsG / UltimateSmartHome.md
Last active January 28, 2020 12:39
An untested ideas list for how to set up a raspberry pi as a hub for home automation.

Home Automation

Install the required software

As per this tutorial or this one

Install the IOTstack: git clone https://github.com/gcgarner/IOTstack.git ~/IOTstack

To start the Menu cd ~/IOTstack

@HarvsG
HarvsG / PiScanner.md
Created December 8, 2019 15:18
Automated raspberry pi scanner

Plan to combine a raspberry pi and a Doxie scanner in an auto network uploader.

Steps:

  1. Find and install raspberry Pi Drivers for the Doxie Go
  2. Auto-mount the doxie and create a watch folder on the doxie
  3. Do JPG -> PDF conversion
  4. Do OCR
  5. Collate related documents somehow
  6. Rename with date in the format 20001225 and ideally extract some title data ?Largest font = title?
  7. Upload to google drive