Skip to content

Instantly share code, notes, and snippets.

View anthonyeden's full-sized avatar
💭
Working on changing the world.

Anthony Eden anthonyeden

💭
Working on changing the world.
View GitHub Profile
@anthonyeden
anthonyeden / blockeditor_enableperpage.php
Created February 14, 2020 09:58
Wordpress: Selectively enable Block Editor per-page
<?php
// Disable the Block Editor on all pages, except specific pages
add_filter('use_block_editor_for_post', '__return_false', 5);
add_filter('use_block_editor_for_post', function($can_edit, $post) {
// Conditionally allow the block editor per-page
if (empty($post->ID)) return $can_edit;
if (get_post_meta($post->ID, 'use_block_editor', true) == true) {
@anthonyeden
anthonyeden / MetaRadioTemplate.xml
Created February 13, 2020 09:49
MBStudio MetaRadio Template
<?xml version="1.0"?>
<MetaNow>
<Type><![CDATA[%code0%]]></Type>
<StartTimestamp><![CDATA[%time0%]]></StartTimestamp>
<Duration><![CDATA[%duration0%]]></Duration>
<Title><![CDATA[%title0%]]></Title>
<Artist><![CDATA[%artist0%]]></Artist>
<Album><![CDATA[%album0%]]></Album>
<Filename><![CDATA[%file0%]]></Filename>
</MetaNow>
@anthonyeden
anthonyeden / MetaRadioFile.xml
Last active February 12, 2020 03:02
Simian XML File - MetaRadio Template
<?xml version="1.0"?>
<MetaNow>
<Type><![CDATA[<!--BSICATEGORY-->]]></Type>
<StartTimestamp><![CDATA[<!--BSIDATE--> <!--BSITIME-->]]></StartTimestamp>
<Duration><![CDATA[<!--BSILENGTH-->]]></Duration>
<Title><![CDATA[<!--BSITITLE-->]]></Title>
<Artist><![CDATA[<!--BSIARTIST-->]]></Artist>
<Album><![CDATA[<!--BSIALBUM-->]]></Album>
<Filename><![CDATA[<!--BSICURRENTFILE-->]]></Filename>
</MetaNow>
@anthonyeden
anthonyeden / silence_gpio.py
Created January 28, 2020 09:56
LWRP Example: Silence Detection & GPIO
# Requires https://github.com/anthonyeden/Livewire-Routing-Protocol-Client
import time
from LWRPClient import LWRPClient
# Connect to audio node
LWRP_Audio = LWRPClient("192.168.1.5", 93)
LWRP_Audio.login()
# Connect to GPIO node
LWRP_Logic = LWRPClient("192.168.1.5", 93)
@anthonyeden
anthonyeden / countdown_5mins.txt
Created July 21, 2019 08:49
Adobe After Effects - Countdown Expressions
st = 300;
t = st - time;
c = timeToTimecode(t);
c = c.substring(4,8)
c
@anthonyeden
anthonyeden / realtime.py
Created December 30, 2018 03:22
Google Analytics Realtime Data
from apiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
VIEW_ID = 'ga:123456789'
def get_service(api_name, api_version, scope, key_file_location,
service_account_email):
"""Get a service that communicates to a Google API.
@anthonyeden
anthonyeden / Responsive-YouTube-Embed-Wordpress-Filters.php
Last active December 1, 2020 11:56
Responsive YouTube Embeds in Wordpress
<?php
add_filter('the_content', function($content) {
return str_replace(array("<iframe", "</iframe>"), array('<div class="iframe-container"><iframe', "</iframe></div>"), $content);
});
add_filter('embed_oembed_html', function ($html, $url, $attr, $post_id) {
if(strpos($html, 'youtube.com') !== false || strpos($html, 'youtu.be') !== false){
return '<div class="embed-responsive embed-responsive-16by9">' . $html . '</div>';
} else {
@anthonyeden
anthonyeden / Windows-10-Basic-Cleanup.ps1
Created December 18, 2018 10:47
Windows 10 Basic Cleanup - Powershell
Get-AppxPackage -allusers *messaging* | Remove-AppxPackage
Get-AppxPackage -allusers *WindowsMaps* | Remove-AppxPackage
Get-AppxPackage -allusers *bing* | Remove-AppxPackage
Get-AppxPackage -allusers *zune* | Remove-AppxPackage
get-appxpackage -allusers *officehub* | remove-appxpackage
get-appxpackage -allusers *skype* | remove-appxpackage
get-appxpackage -allusers *people* | remove-appxpackage
get-appxpackage -allusers *solitaire* | remove-appxpackage
get-appxpackage -allusers *xbox* | remove-appxpackage
Get-AppxPackage -allusers *windowscommunicationsapps* | Remove-AppxPackage
@anthonyeden
anthonyeden / XML-Sample2.lua
Last active May 4, 2020 08:16
Telos ZipStream - Sample XML Metadata Filter
-- ------------------------------------------------------------------
-- MetaData Filter. Copyright (C) 2011 Tls Corporation
-- Author: Ioan L. Rus
--
-- Lines that start with two dashes (like this line) are comments.
--
-- Metadata filters are written in a very simple programming
-- language named Lua. Additional information about the language
-- and it's syntax can be found at http://www.lua.org.
--
@anthonyeden
anthonyeden / ZettaPowergoldAssetImport.py
Created October 19, 2018 02:13
Zetta to Powergold Asset Import
"""
This script is designed to export all music from a specific Zetta category to a text file, ready for Powergold to import.
Written by Anthony Eden (https://mediarealm.com.au/)
"""
import os
import sys
import json
import pypyodbc
import io