Skip to content

Instantly share code, notes, and snippets.

View zachfeldman's full-sized avatar

Zach Feldman zachfeldman

View GitHub Profile
@zachfeldman
zachfeldman / garage_door_close_x_minutes.yaml
Last active March 25, 2023 23:03
garage_door_close_x_minutes
blueprint:
name: Garage Door Close after 10 minutes
domain: automation
input:
garage_door_target:
name: Monitored Sensor
description: Garage door itself
selector:
entity:
domain: cover
@zachfeldman
zachfeldman / mount-encrypted-ubuntu-rpool from LiveUSB
Last active November 24, 2022 00:07
Recover system on Ubuntu LiveUSB with an encrypted rpool
# Heavily copied from https://develmonk.com/2022/05/20/mount-ubuntu-22-04-zfs-partitions-using-live-iso-for-disaster-recovery/ and https://askubuntu.com/questions/1332447/how-to-mount-an-encrypted-ubuntu-20-10-zfs-file-system-from-an-ubuntu-live-cd - kudos!
# No implied warranty - use at your own risk!
# Run as root
sudo su -
# Mount the rpool to extract the system key
zpool import rpool -R /mnt
# Get the system key for the rpool. You'll be prompted for the password
@zachfeldman
zachfeldman / gist:bfc7bac4543d466e9c096d585e373fbf
Created February 25, 2018 03:31
Working Tesseract 3.0.2 brew script for Mac OS X
class Tesseract < Formula
desc "OCR (Optical Character Recognition) engine"
homepage "https://github.com/tesseract-ocr/"
url "https://osdn.net/frs/g_redir.php?m=netix&f=%2Ftesseract-ocr-alt%2Ftesseract-ocr-3.02.02.tar.gz"
sha256 "26cd39cb3f2a6f6f1bf4050d1cc0aae35edee49eb49a92df3cb7f9487caa013d"
# revision 3
bottle do
# revision 1
sha256 "19d4caa5ce632ca41d3b45accd7f116f6cf93688531f26437cb4833f26cc0172" => :yosemite
@zachfeldman
zachfeldman / aws_boilerplate.rb
Created October 10, 2016 17:55
Alexa-Web-Service Boilerplate
require 'sinatra'
require 'alexa_web_service'
require 'json'
before do
@data = request.body.read
begin
params.merge!(JSON.parse(@data))
rescue JSON::ParserError
halt 400, "Bad Request"
@zachfeldman
zachfeldman / gist:b4f302eff20a58d25b19
Created May 12, 2015 18:09
Passcard verification
Verifying I am +zachfeldman on my passcard. https://onename.com/zachfeldman
@zachfeldman
zachfeldman / gist:78f6a9ac693d5e3b8df2
Created January 7, 2015 21:08
Advanced Custom Fields - get_post_id_from_repeater_sub_field
function get_post_id_from_repeater_sub_field($parent_name, $child_name, $meta_value){
global $wpdb;
$rows = $wpdb->get_results($wpdb->prepare(
"
SELECT wp_posts.ID
FROM wp_postmeta
JOIN wp_posts
ON wp_postmeta.post_id=wp_posts.ID
WHERE wp_postmeta.meta_key LIKE %s
AND wp_postmeta.meta_value = %s
// life motto
function sad(your_life){
this.stop == function(){
console.log("Stop being sad, fool!")
}
// Pseudocode for now,
// basically should determine
// sadness based on life factors
### Keybase proof
I hereby claim:
* I am zachfeldman on github.
* I am zachfeldman (https://keybase.io/zachfeldman) on keybase.
* I have a public key whose fingerprint is 0EF8 B817 E5D3 BB73 BB1F B74B 5B84 F085 FFB6 AADD
To claim this, I am signing this object: