Skip to content

Instantly share code, notes, and snippets.

@Egregius
Egregius / createramdiskatboot.command
Created Sep 9, 2020
Use RAM disk for macOS caches and logs
View createramdiskatboot.command
#!/bin/bash
while [ ! -d /Volumes ]
do
echo "waiting..."
sleep 0.5
done
if [ ! -d /Volumes/RamDisk ]; then
echo "creating ramdisk..."
sleep 0.5
diskutil partitionDisk $(hdiutil attach -nomount ram://$((2048*16000))) 1 GPTFormat APFS 'RamDisk' '100%'
View com.user.SSDsmart.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.SSDsmart</string>
<key>ProgramArguments</key>
<array>
<string>/Users/guy/OneDrive/MyApps/readsmart.sh</string>
@Egregius
Egregius / snapshots.sh
Created Feb 15, 2020
Synology btrfs snapshots when needed.
View snapshots.sh
#!/bin/sh
NOW=$(date +"%Y-%m-%d")
BPATH=/volume1/Guy/log
RUNLOG=/volume1/Guy/log/$NOW.txt
NAME="Guy"
echo ------------------- START SNAPSHOT $NAME -- $(date) | tee -a $RUNLOG
SOURCE="/volume1/$NAME"
LAST=$(find $SOURCE -type d -name '#snapshot' -prune -o -type d -name 'log' -prune -o -type f -printf '%T@\n' | sort -n | tail -1 | cut -f1- -d" ")
PREV=$(cat "$BPATH/timestamp_$NAME.txt")
@Egregius
Egregius / .htaccess
Created Feb 8, 2020
ifttt applet skipped fix
View .htaccess
Header unset Upgrade
@Egregius
Egregius / storetemps.php
Last active Apr 26, 2021
Store temperature data from Domoticz in mySQL for historical analyses
View storetemps.php
<?php
define('sqlserver','127.0.0.1');
define('sqluser','domotica');
define('sqlpassword','domotica');
define('sqldatabase','domotica');
define('updatedatabase',true);//Set to false once the database is created, set to true to add devices
define('domoticzip','127.0.0.1');
define('domoticzport','8080');
define('numberofhours',1);//Defines how many hours of detailed data is updated in _day table. Set to a high number for initial run.
define('numberofdays',1);//Defindes how many days of min,avg and max is updated in _month table. Set to a high number for initial run.
View My Exiftool Cheatsheet.md

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

View pass2php.lua
JSON = (loadfile '/volume1/@appstore/domoticz/var/scripts/lua/JSON.lua')()
base64 = loadfile('/volume1/@appstore/domoticz/var/scripts/lua/ee5_base64.lua')()
enc_devicechanged = base64.encode(JSON:encode(devicechanged))
enc_otherdevices = base64.encode(JSON:encode(otherdevices))
enc_otherdevices_idx = base64.encode(JSON:encode(otherdevices_idx))
enc_otherdevices_lastupdate = base64.encode(JSON:encode(otherdevices_lastupdate))
enc_otherdevices_svalues = base64.encode(JSON:encode(otherdevices_svalues))
os.execute( '/volume1/web/secure/pass2php.php "device" "' ..enc_devicechanged.. '" "' ..enc_otherdevices.. '" "' ..enc_otherdevices_idx.. '" "' ..enc_otherdevices_lastupdate.. '" "' ..enc_otherdevices_svalues.. '" &')
commandArray = {}
return commandArray