Skip to content

Instantly share code, notes, and snippets.

View nullvariable's full-sized avatar
☣️

Doug Cone nullvariable

☣️
View GitHub Profile
@nullvariable
nullvariable / debug.lua
Created April 23, 2022 17:28
debug height or whatever
function DrawText3Ds(x, y, z, text)
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(true)
AddTextComponentString(text)
SetDrawOrigin(x,y,z, 0)
let openTime = new Date( MyqDevices.doorOpened.CreatedAt )
let sunriseAt = new Date( Weather.currentWeather[0].SunriseAt )
let sunsetAt = new Date( Weather.currentWeather[0].SunsetAt )
if ( openTime > sunriseAt && openTime < sunsetAt ) {
Wyzecam.plugTurnOn.skip()
}
@nullvariable
nullvariable / private-files.php
Created September 29, 2020 18:43
Private Files Example for Pantheon
<?php
/**
* Plugin Name: Example Private Files
* Author: Doug Cone
* Description: Auth for Pantheon Private files
* Version: 0.1.0
*/
/**
* This doesn't protect direct access, you must move your files to a folder not accessible to the public, but accessible to this script.
@nullvariable
nullvariable / README.md
Last active October 25, 2019 14:05
Simple script to select browser

Steps to get this working in Ubuntu 18.04

  • edit whichbrowser.sh as you see fit
    • handy way to see your Chrome profiles: cat ~/.config/google-chrome/Local\ State | jq .profile
  • copy whichbrowser.sh to /usr/local/bin/whichbrowser
  • copy whichbrowser.desktop to /usr/share/applications
  • edit /usr/share/applications/defaults.list to add whichbrowser.desktop to the same handlers as chrome/firefox
  • run sudo update-desktop-database
  • use Ubuntu settings -> Details -> Default Applications, to change default web browser to whichbrowser script
  • ???
  • profit
@nullvariable
nullvariable / pantheon.yml
Created September 20, 2019 16:42
Create symlinks with Quicksilver
api_version: 1
workflows:
sync_code:
after:
- type: webphp
description: Create symlinks
script: private/symlinks.php
@nullvariable
nullvariable / functions.php
Created August 20, 2019 20:32
Remove query strings from WordPress static assets
<?php
function remove_query_strings() {
if(!is_admin()) {
add_filter('script_loader_src', 'strip_query_string', 15);
add_filter('style_loader_src', 'strip_query_string', 15);
}
}
function strip_query_string($src){
$output = preg_split("/(&ver|\?ver)/", $src);
@nullvariable
nullvariable / cache-aggressive-license-checks.php
Last active January 24, 2023 11:59
Make annoying WordPress plugins that constantly perform license checks in the admin behave.
<?php
/**
* Plugin Name: Cache Aggressive License Checks
* Description: Cache the license checks for plugins that are lame and check on every request.
* Author: Doug Cone
* Author URI: http://dougcone.com
* Version: 0.0.1
*
*/
@nullvariable
nullvariable / composer.json
Created May 7, 2019 21:08
Use typerocket with root composer.json
{
"require": {
"typerocket/core": "4.0.*"
},
"scripts": {
"typerocket-migrate": [
"php ./wp-content/mu-plugins/typerocket/galaxy migrate up"
]
}
}
@nullvariable
nullvariable / functions.php
Created March 12, 2019 18:10
don't send user count to wp.org stats.
<?php
add_filter( 'core_version_check_query_args', 'hide_stats', 99 );
function hide_stats( $query ) {
$query['blogs'] = 1;
$query['users'] = 1;
return $query;
}
@nullvariable
nullvariable / wp-cli.php
Last active February 27, 2019 17:56
use wp-cli as a proxy for typerocket galaxy commands
<?php
if ( defined( 'WP_CLI' ) && WP_CLI ) {
\WP_CLI::add_command( 'galaxy', function () {
$count = count( $_SERVER['argv'] );
for ( $i = 0; $i < $count; $i++ ) {
// strip any preceeding arguments so galaxy isn't confused.
$arg = array_shift( $_SERVER['argv'] );
if ( 'galaxy' == $arg ) {
array_unshift( $_SERVER['argv'], 'galaxy' );
break;