Skip to content

Instantly share code, notes, and snippets.

View ctalkington's full-sized avatar

Chris Talkington ctalkington

View GitHub Profile
@bdraco
bdraco / core_integration_pr
Last active December 1, 2023 07:26 — forked from ludeeus/core_integration_pr
Install HA Core PR as custom component
#!/bin/bash
# curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d domain -p 12345
while getopts d:p: flag
do
case "${flag}" in
d) domain="${OPTARG}";;
p) pull_request="${OPTARG}";;
esac
done
@awarecan
awarecan / lambda_function.py
Last active March 14, 2024 19:26
Alexa Smart Home Skill Adapter for Home Assistant
"""
Copyright 2019 Jason Hu <awaregit at gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@ambivalentno
ambivalentno / test_client_fake_server.py
Created November 17, 2017 13:48
pytest-asyncio aiohttp client testing with fake server
import asyncio
import pathlib
import socket
import ssl
import pytest
import aiohttp
from aiohttp import web
from aiohttp.resolver import DefaultResolver
@willbroderick
willbroderick / seo-hacks.liquid
Last active March 22, 2021 16:50
Shopify SEO - attempt to avoid duplicate meta descriptions
Two changes to make in theme.liquid
It will add 'Page 2' etc to the meta description for collection/blog pages, to make those different.
It adds a canonical tag for tag-filtered pages, back to the base collection/blog page.
*** This is the standard meta description code: ***
{% if page_description %}
<meta name="description" content="{{ page_description | escape }}" />
{% endif %}
@nathanrice
nathanrice / functions.php
Created January 6, 2016 16:41
Add back blogPosting Schema to Genesis sites
<?php
/*
Add back Schema.org/blogPosting microdata to post entries.
Replace all instances of "themedemo" with something unique to your site.
User input is required in the last function. Be sure to fill these fields in with your own information.
Instances where you need to fill in information will be marked with a comment that indicates so.
*/
@gbot
gbot / wp-xmlrpc-jail.local
Last active July 26, 2023 17:07
Fail2Ban WordPress XMLRPC Jail and Filter. Notes: log path is set for Plesk v12.x. Change this to appropriate path for your set up. Only works if WordPress is installed in webroot, edit the Filter failregex if installed in sub-directory.
[wp-xmlrpc]
enabled = true
filter = wp-xmlrpc
action = iptables-multiport[name=wp-xmlrpc, port="http,https"]
logpath = /var/www/vhosts/system/*/logs/*access*log
/var/log/httpd/*access_log
bantime = 86400
maxretry = 0
@shanebp
shanebp / bp-profile-tab-and-subnav.php
Last active June 28, 2023 18:11
BuddyPress add profile tab and subnav
function add_animal_tabs() {
global $bp;
bp_core_new_nav_item( array(
'name' => 'Animals',
'slug' => 'animals',
'parent_url' => $bp->displayed_user->domain,
'parent_slug' => $bp->profile->slug,
'screen_function' => 'animals_screen',
'position' => 200,
@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@jchristopher
jchristopher / gist:8833e71f1d9c8afaf58b
Created August 14, 2014 15:56
Make [video] in WordPress 3.9 responsive
// still not sure why
video {
width: 100%;
height: 100%;
max-width: 100%;
}
.wp-video {
width: 100% !important;
}
@davidmh
davidmh / custom-post-type-archive-menu-links.php
Last active October 14, 2016 08:11 — forked from helgatheviking/custom-post-type-archive-menu-links.php
Adds Custom Post Type archives to the WordPress-powered menus. Compatible with WP 3.8
<?php
/*
Plugin Name: Custom Post Type Archive Menu Links
Plugin URI: http://codeseekah.com/2012/03/01/custom-post-type-archives-in-wordpress-menus-2/
Description: Easily Add Custom Post Type Archives to the Nav Menus
Version: 1.1
Author: soulseekah
Author URI: http://codeseekah.com
License: GPL2