Skip to content

Instantly share code, notes, and snippets.

View drbayer's full-sized avatar

David Bayer drbayer

View GitHub Profile
#!/usr/bin/env bash
cd /home/pi/rpi-pushbutton
. venv/bin/activate
python rpi-pushbutton.py &
#!/usr/bin/env python3
from datetime import date, datetime
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import RPi.GPIO as GPIO
from time import sleep
credential_file = "my-project-0123456789ab.json"
from datetime import date, datetime
import gspread
from oauth2client.service_account import ServiceAccountCredentials
credential_file = "my-project-0123456789ab.json"
google_sheets_file = "MySheet"
def record_time(channel):
import RPi.GPIO as GPIO
gpio_input_pin = 10
def button_pressed(channel):
print("button pressed")
GPIO.setwarnings(False)
@drbayer
drbayer / docker-compose.yml
Created February 24, 2021 05:00
docker-compose file for calibredb
version: '3'
services:
calibre-web:
image: linuxserver/calibre-web
environment:
- DOCKER_MODS=linuxserver/calibre-web:calibre
volumes:
- ../books:/books
- ../data:/config
#!/bin/bash
set -eE
date_format="%Y-%m-%d %T.%3N%z"
today=$(date +"%Y%m%d")
backup_dir=/tmp
cluster=$(cat /tmp/environment)
s3_bucket=$cluster
verbose="false"
$ ./neo4j-backup.sh -h
Usage: neo4j-backup.sh -b S3BUCKET [-d BACKUPDIR] [-c CLUSTER_NAME] [-h]
-b S3 bucket to store backups in. Defaults to CLUSTER_NAME
-c Neo4j cluster name. Defaults to value in /tmp/environment
-d Local directory to create backups in. Defaults to /tmp
-h Show this help message
-v Verbose output
usage() {
echo "Usage: ${0##*/} -b S3BUCKET [-d BACKUPDIR] [-c CLUSTER_NAME] [-h]"
echo
echo " -b S3 bucket to store backups in. Defaults to CLUSTER_NAME"
echo " -c Neo4j cluster name. Defaults to value in /tmp/environment"
echo " -d Local directory to create backups in. Defaults to /tmp"
echo " -h Show this help message"
echo " -v Verbose output"
echo
exit 5
$myarray = @()
foreach ($item in $mylistofthings) {
$myobj = New-Object -TypeName PSObject
Add-Member -InputObject $myobj -MemberType 'NoteProperty' -Name 'Property1' -Value $item.Property1
Add-Member -InputObject $myobj -MemberType 'NoteProperty' -Name 'Property2' -Value $item.Property2
$myarray += $myobj
}
$myarray = (("item1","value1"),("item2","value2"),("item3","value3"))