Skip to content

Instantly share code, notes, and snippets.

View phybros's full-sized avatar
🏠
Working from home

Will Warren phybros

🏠
Working from home
View GitHub Profile
@phybros
phybros / gist:edf2a948ca7fc1b0483dde178f8c8d45
Last active February 19, 2022 21:20
Fix photo metadata from Google Photos to Apple Photos import
exiftool -r -d %s -tagsfromfile "%d/%F.json" \
"-GPSAltitude<GeoDataAltitude" \
"-GPSLatitude<GeoDataLatitude" \
"-GPSLatitudeRef<GeoDataLatitude" \
"-GPSLongitude<GeoDataLongitude" \
"-GPSLongitudeRef<GeoDataLongitude" \
"-Keywords<Tags" \
"-Subject<Tags" \
"-Caption-Abstract<Description" \
"-ImageDescription<Description" \
@phybros
phybros / 00-usb-wifi
Last active August 2, 2020 22:04
Setting up wifi on raspberry pi
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "Your Network SSID"
wpa-psk "Your Password"
@phybros
phybros / update-route53.sh
Last active February 12, 2024 00:07
BASH Script to keep Route53 updated with your current external IP address
#!/bin/bash
# (optional) You might need to set your PATH variable at the top here
# depending on how you run this script
#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Hosted Zone ID e.g. BJBK35SKMM9OE
ZONEID="enter zone id here"
# The CNAME you want to update e.g. hello.example.com
@phybros
phybros / StopWatchUsageS3.php
Created September 27, 2013 13:55
More advanced usage of the stopwatch class
<?php
// create a new S3 instance
$s3 = new S3('my access key', 'my secret key');
// start the timer
StopWatch::start();
// read & send the file
$f = $s3->inputFile('file_to_upload.zip');
$r = $s3->putObject($f, 'my-bucket-name', 'uploaded_file.zip', S3::ACL_PUBLIC_READ);
@phybros
phybros / StopWatchUsageSimple.php
Created September 27, 2013 13:53
Usage of the StopWatch class
<?php
// start the timer
StopWatch::start();
// sleep for 2 seconds
sleep(2);
// check how long 2 seconds is...
echo "Elapsed time: " . StopWatch::elapsed() . " seconds";
@phybros
phybros / ErrorStudy.php
Created June 13, 2013 03:07
Just playing around finding the nicest ways to trap errors in PHP
<?php
header("Content-Type: text/plain");
function my_error_handler($num, $err, $file, $line) {
echo "Error Occurred: $err\n";
}
set_error_handler('my_error_handler', E_ALL);
try {
@phybros
phybros / StopWatch.php
Last active August 31, 2017 13:50
A simple "StopWatch" class to measure PHP execution time. The class can handle multiple separate timers at the same time.
<?php
class StopWatch {
/**
* @var $start float The start time of the StopWatch
*/
private static $startTimes = array();
/**
* Start the timer
*