Skip to content

Instantly share code, notes, and snippets.

View alexclst's full-sized avatar

Alexander Celeste alexclst

  • Minnesota, United States
  • 13:11 (UTC -05:00)
View GitHub Profile
@alexclst
alexclst / build phase.sh
Last active August 3, 2017 18:15
Git Commit Data to InfoPlist iOS (code discussed in this Tenseg blog post: http://www.tenseg.net/blog/2017/08/03/git-commit-info-in-your-app/)
#!/bin/bash
# Add this as a new Run Script build phase for your target.
# Created by Alexander Celeste on 8/1/17.
# Based on http://kelan.io/2008/xcode-run-script-build-phase-tip/
script_file="git-commit-num-to-build-num.sh"
echo "Running a custom build phase script: $script_file"
@alexclst
alexclst / sshd_config
Created December 28, 2019 23:22
SSH Config without Password Auth
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@alexclst
alexclst / db-error.php
Last active March 19, 2020 21:38
DB Error File Example for WP
<?php
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 3600'); // 1 hour = 3600 seconds
?>
<!DOCTYPE html>
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
<meta charset="UTF-8" />
@alexclst
alexclst / unserialize.sh
Last active June 25, 2020 19:43
BBEdit text filter to unserialize WP data into pretty JSON.
#! /usr/local/bin/php
<?php
// unserialize input
$data = unserialize(trim(fgets(STDIN)));
// print it as pretty unescaped json
echo json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
@alexclst
alexclst / com.homebridge.server.plist
Created July 15, 2020 18:19
Launchd plist for running Homebridge on macOS.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>HOME</key>
<string>/Users/apple</string>
<key>PATH</key>
<string>/Users/apple/.yarn/bin:/Users/apple/.config/yarn/global/node_modules/.bin:/usr/local/opt/unison@2.40/bin:/Users/apple/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
@alexclst
alexclst / broadlink-rm-platform.json
Last active July 15, 2020 19:22
My platforms entry in Homebridge for BroadlinkRM IR blasters.
@alexclst
alexclst / sendusernotification.sh
Last active September 13, 2020 02:09
Shell script to encapsulate sending user notifications
#!/bin/bash
# sendusernotification.sh
# Created by Alexander Celeste for Tenseg in March 2016
# This script can be used to send user notifications to Notification Center, regularly just to OS X, but also to the Prowl iOS app if the Mac is idle
# It can be used in long-running scripts to notify of completion, and in scripts that run via launchd to notify of files being added to folders, or really any use you can dream up
# Dependencies:
# * terminal-notifier: https://github.com/julienXX/terminal-notifier
# * prowl.pl: https://www.prowlapp.com/static/prowl.pl
# get inputs
@alexclst
alexclst / deploy-wp-plugin.sh
Last active August 12, 2021 15:59
Git hook to deploy a WP plugin.
#! /bin/bash
#
# A script meant to run on the `post-recieve` Git hook to deploy to WordPress.org whenever a new version tag is pushed in.
# include common post-recieve functions
# from https://github.com/stephenh/git-central/blob/master/server/functions
root_dir=$(dirname $0)
. $root_dir/post-recieve-functions.sh
# cleans up before exiting
@alexclst
alexclst / force-stripe-testmode.php
Created February 10, 2023 17:01
Force Stripe Test Mode in WooCommerce
<?php
/**
* Plugin Name: Force Stripe Test Mode
* Plugin URI: https://tenseg.net
* Description: Forces Stripe into test mode if TG_STRIPE_TEST_MODE defined as 'yes'.
* Author: Tenseg LLC
* Author URI: https://tenseg.net
* Text Domain: force-stripe-test-mode
* Version: 1.0.0
@alexclst
alexclst / homebrewupdate.sh
Last active March 15, 2023 02:31
Homebrew Update
#!/bin/sh
# updates Homebrew and installed packages
# requires being run as admin or root user
# here for reference as to the steps, but not run as script in launchd anymore
# partly because Homebrew updates itself anytime you install a new package these days
/bin/date
/opt/homebrew/bin/brew update
/opt/homebrew/bin/brew upgrade