Skip to content

Instantly share code, notes, and snippets.

View PJTewkesbury's full-sized avatar

Peter T PJTewkesbury

View GitHub Profile
@PJTewkesbury
PJTewkesbury / Lsyncd Technical Session.md
Created November 20, 2022 15:33 — forked from mralexjuarez/Lsyncd Technical Session.md
Quick Tutorial on Using Lsyncd

Lsyncd Technical Session

So what is lsyncd?

Lsyncd is a tool used to keep a source directory in sync with other local or remote directories. It is a solution suited keeping directories in sync by batch processing changes over to the synced directories.

When would we use lsyncd?

So the generic use case is to keep a source directory in sync with one or more local and remote directories.

@PJTewkesbury
PJTewkesbury / emailwiz.sh
Last active December 21, 2021 08:26
Email Install (Dovecot, Postfix, SpamAssassin, OpenDKIM)
#!/bin/sh
# THE SETUP
# Mail will be stored in non-retarded Maildirs because it's $currentyear. This
# makes it easier for use with isync, which is what I care about so I can have
# an offline repo of mail.
# The mailbox names are: Inbox, Sent, Drafts, Archive, Junk, Trash
@PJTewkesbury
PJTewkesbury / VPN Config
Last active August 20, 2021 14:15
VPNServer install
# Software Configuration File
# ---------------------------
#
# You may edit this file when the VPN Server / Client / Bridge program is not running.
#
# In prior to edit this file manually by your text editor,
# shutdown the VPN Server / Client / Bridge background service.
# Otherwise, all changes will be lost.
#
declare root
@PJTewkesbury
PJTewkesbury / InstallTailScale.sh
Last active December 22, 2022 09:19
Install TailScale
#!/bin/bash
curl -fsSL https://pkgs.tailscale.com/stable/raspbian/buster.gpg | sudo apt-key add -
curl -fsSL https://pkgs.tailscale.com/stable/raspbian/buster.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt-get update
sudo apt-get install tailscale
sudo systemctl start tailscale
sudo tailscale up --authkey tskey-auth-kKtuoK5CNTRL-k5sMzVPkz6Nvn2g6Efw67Nf5qJ31MGp2 --hostname=$HOSTNAME --ssh
sudo ip addr show tailscale0

Install raspbian, set up your users however you would like, so long as you have sudo access on the user you are running this with. You probably want to resize the image so it fills the SD card as well.

  1. Copy this entire gist to your raspberry pi
  2. Do chmod +x step1.sh step2.sh iptables.sh in the gist folder (so that
  3. Run step1.sh a) This script does a few things - it first updates your raspberry pi, then it installs a few needed utilities, then it upgrades the firmware on your raspberry pi
@PJTewkesbury
PJTewkesbury / BuildClockPi.sh
Last active January 3, 2023 12:43
Build ClockPI
#!/bin/bash
# This script requires the following enviroment variables to be defined before calling this script.
IPADDR_ETH0="192.168.0.16"
IPADDR_WLAN0="192.168.0.17"
ROOTPW="ClockPIP@ssw0rd"
wget -O ./BuildPiCore.sh https://gist.github.com/PJTewkesbury/142815aace9f37f36fe8ef90cb683102/raw
chmod +x ./BuildPiCore.sh
source "./BuildPiCore.sh"
@PJTewkesbury
PJTewkesbury / BuildServerPI.sh
Last active January 16, 2023 10:08
Build Server PI
#!/bin/bash
# wget -O - Url | bash
# This script requires the following enviroment variables to be defined before calling this script.
IPADDR_ETH0="192.168.0.14"
IPADDR_WLAN0="192.168.0.15"
ROOTPW="ServerPI@ssword"
DISKLABEL=""
USBDISKLABEL=""
#include <wiringPi.h>
#include <wiringPiSPI.h>
#include <iostream>
#include <stdint.h>
int main() {
wiringPiSetup();
if(wiringPiSPISetup(0, 6000000) < 0) {
std::cerr << "wiringPiSPISetup failed" << std::endl;
}
@PJTewkesbury
PJTewkesbury / SolarInfo.cs
Last active April 29, 2016 14:53 — forked from cstrahan/SolarInfo.cs
A sunrise/sunset calculator.
// http://www.esrl.noaa.gov/gmd/grad/solcalc/calcdetails.html
// http://www.esrl.noaa.gov/gmd/grad/solcalc/index.html
using System;
using System.Diagnostics;
namespace SunriseCalculator
{
public class SolarInfo