Skip to content

Instantly share code, notes, and snippets.

@Coopeh
Coopeh / com.onair.app.plist
Last active November 30, 2021 14:37
Quick fish shell script to run a HASS trigger when a microphone is active on MacOS, in this case to turn an On Air light on and off.
<?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>Label</key>
<string>com.onair.app</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/fish</string>
<string>/opt/scripts/onair.fish</string>
chef-client -o 'recipe[test::default],recipe[test2::default],role[test]'
@Coopeh
Coopeh / kill-session.sh
Last active December 22, 2021 19:41
SSH Idle Session Kicker
#!/usr/bin/env bash
###
#
# SSH Inactive Session Killer
#
###
# Set idle time in hours - default is 12
idle_time="12"
<?php $time_start = microtime(true);
// Add multiple IPs to blacklist, whitelist or unlist them on Cloudflare using CloudFlare API by AzzA <azza@broadcasthe.net>
// Ed Cooper 2015 - https://blog.ed.gs
// Version 1.0
// Configure your API key and email address below
$cfemailaddress = "your@email.com"; // Cloudflare email address
$cfapikey = "1234123412341234123412341234"; // Cloudflare API key
@Coopeh
Coopeh / sickbeard-clean-library.rb
Last active April 4, 2016 17:47 — forked from Sutto/sickbeard-clean-library.rb
Moved a folder? Clean your sickbeard library... Updated to work with imdb_id instead of tvdb_id
require 'rubygems'
require 'sequel'
database = Sequel.connect('sqlite://sickbeard.db')
database[:tv_episodes].select(:location, :episode_id).exclude(:location => "").each do |show|
if !File.file?(show[:location])
database[:tv_episodes].filter(:episode_id => show[:episode_id]).delete
end
end

Keybase proof

I hereby claim:

  • I am coopeh on github.
  • I am coopeh (https://keybase.io/coopeh) on keybase.
  • I have a public key whose fingerprint is 7978 9DD5 7939 999E D244 9EA7 589D FAA6 0ECE C670

To claim this, I am signing this object:

@Coopeh
Coopeh / sophosremoval.bat
Created January 17, 2014 08:23
Sophos Removal Script
@ECHO OFF
ECHO ====================================================================
ECHO Sophos Removal v1.0 - Ed Cooper 2014
ECHO Removes Sophos v7 - v10
ECHO ====================================================================
ECHO.
ECHO.
IF NOT EXIST "%~dp0\msizap.exe" GOTO MSIZAPNOTFOUND
ECHO Administrative permissions required. Detecting permissions...
ECHO.
@Coopeh
Coopeh / cloudflare_cachepurge.php
Last active December 23, 2015 16:09
Fix Cloudflare Purge plugin to allow Multisite WordPress MU Domain Mapping support
/*
Save Post Hook
*/
function ccpurge_purge_after_save_post_hook( $post_id ){
// possible options...
// add_action('pending_to_publish', 'ccpurge_purge');
// add_action('draft_to_publish', 'ccpurge_purge');
// add_action('new_to_publish', 'ccpurge_purge');
@Coopeh
Coopeh / old-superuser.log
Created June 3, 2013 13:03
old-superuser.log
Flow
wp_register_sidebar_widget action - __lambda_func() in /wp-content/plugins/debug-bar-extender/debug-bar-extender.php(222) : runtime-created function::L1
called from call_user_func_array() in ::L #1 ( 0.00ms @ 0.00ms )
wp_register_sidebar_widget action - __lambda_func() in /wp-content/plugins/debug-bar-extender/debug-bar-extender.php(222) : runtime-created function::L1
called from call_user_func_array() in ::L #2 ( 0.41ms @ 0.41ms )
wp_register_sidebar_widget action - __lambda_func() in /wp-content/plugins/debug-bar-extender/debug-bar-extender.php(222) : runtime-created function::L1
called from call_user_func_array() in ::L #3 ( 10.80ms @ 11.21ms )
wp_register_sidebar_widget action - __lambda_func() in /wp-content/plugins/debug-bar-extender/debug-bar-extender.php(222) : runtime-created function::L1
called from call_user_func_array() in ::L #4 ( 0.14ms @ 11.35ms )