Skip to content

Instantly share code, notes, and snippets.

View dvdsmpsn's full-sized avatar

David Simpson dvdsmpsn

View GitHub Profile
@dvdsmpsn
dvdsmpsn / README.md
Created November 14, 2015 20:14 — forked from teffalump/README.md
OpenWRT adblock implementation

Description

In its basic usage, this script will modify the router such that blocked addresses are null routed and unreachable. Since the address blocklist is full of advertising, malware, and tracking servers, this setup is generally a good thing. In addition, the router will update the blocklist weekly. However, the blocking is leaky, so do not expect everything to be blocked.

Setup

The script must be copied to an OpenWRT router (gargoyle firmware works fine, too).

For example, if the router is located at 192.168.1.1:

@dvdsmpsn
dvdsmpsn / ai-llm-share.js
Last active December 4, 2025 13:30
ai-llm-share.js
/**
* Client side version of https://github.com/metehan777/ai-llm-share-wp-plugin/
*
* Add AI-powered share buttons (ChatGPT, Perplexity, Claude, Grok, Google AI)
* alongside traditional social share buttons to boost your content visibility
* in AI engines and increase LLM citations.
*/
(function() {
function addShareButtons(targetSelector) {
// Get the post URL and title
@dvdsmpsn
dvdsmpsn / spaces-by-category-user-macro.vm
Last active April 25, 2025 12:48
Confluence User Macro: Spaces By Category
## User Macro: spaces-by-category
##
## Created by: David Simpson <david@appfusions.com> 2014-08
## Adapted from Remo Siegwart's answer at http://web.archive.org/web/20140813094412/https://answers.atlassian.com/questions/274837/show-a-space-list-within-a-page-using-category-label
##
## @param Label:title=Space Category|type=string|required=true|desc=The category you want to list spaces from.
## try to get space category
#set ( $spaceLabel = $action.labelManager.getLabel( "team:${paramLabel}" ) )
Name SMILES
Aspirin O=C(C)Oc1ccccc1C(=O)O
Acetylene C#C
Adenosine triphosphate O=P(O)(O)OP(=O)(O)OP(=O)(O)OC[C@H]3O[C@@H](n2cnc1c(ncnc12)N)[C@H](O)[C@@H]3O
Ampicillin CC1(C(N2C(S1)C(C2=O)NC(=O)C(C3=CC=CC=C3)N)C(=O)O)C
Chemistry of ascorbic acid C([C@@H]([C@@H]1C(=C(C(=O)O1)O)O)O)O
Chemistry of ascorbic acid OC=1C(OC(=O)C=1O)[C@@H](O)CO
Amphetamine NC(C)Cc1ccccc1
Aspartame O=C(O)C[C@H](N)C(=O)N[C@H](C(=O)OC)Cc1ccccc1
Amoxicillin O=C(O)[C@@H]2N3C(=O)[C@@H](NC(=O)[C@@H](c1ccc(O)cc1)N)[C@H]3SC2(C)C
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 14 columns, instead of 11 in line 7.
Region,Country,Item Type,Sales Channel,Order Priority,Order Date,Order ID,Ship Date,Units Sold,Unit Price,Unit Cost,Total Revenue,Total Cost,Total Profit
Australia and Oceania,Tuvalu,Baby Food,Offline,H,5/28/2010,669165933,6/27/2010,9925,255.28,159.42,2533654.00,1582243.50,951410.50
Central America and the Caribbean,Grenada,Cereal,Online,C,8/22/2012,963881480,9/15/2012,2804,205.70,117.11,576782.80,328376.44,248406.36
Europe,Russia,Office Supplies,Offline,L,5/2/2014,341417157,5/8/2014,1779,651.21,524.96,1158502.59,933903.84,224598.75
Sub-Saharan Africa,Sao Tome and Principe,Fruits,Online,C,6/20/2014,514321792,7/5/2014,8102,9.33,6.92,75591.66,56065.84,19525.82
Sub-Saharan Africa,Rwanda,Office Supplies,Offline,L,2/1/2013,115456712,2/6/2013,5062,651.21,524.96,3296425.02,2657347.52,639077.50
Australia and Oceania,Solomon Islands,Baby Food,Online,C,2/4/2015,547995746,2/21/2015,2974,255.28,159.42,759202.72,474115.08,285087.64
Sub-Saharan Africa,Angola,Household,Offline,M,4/23/2011,135425221,4/27/2011,4187,668.27,502
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 14 columns, instead of 3 in line 8.
Region,Country,Item Type,Sales Channel,Order Priority,Order Date,Order ID,Ship Date,Units Sold,Unit Price,Unit Cost,Total Revenue,Total Cost,Total Profit
Middle East and North Africa,Libya,Cosmetics,Offline,M,10/18/2014,686800706,10/31/2014,8446,437.20,263.33,3692591.20,2224085.18,1468506.02
North America,Canada,Vegetables,Online,M,11/7/2011,185941302,12/8/2011,3018,154.06,90.93,464953.08,274426.74,190526.34
Middle East and North Africa,Libya,Baby Food,Offline,C,10/31/2016,246222341,12/9/2016,1517,255.28,159.42,387259.76,241840.14,145419.62
Asia,Japan,Cereal,Offline,C,4/10/2010,161442649,5/12/2010,3322,205.70,117.11,683335.40,389039.42,294295.98
Sub-Saharan Africa,Chad,Fruits,Offline,H,8/16/2011,645713555,8/31/2011,9845,9.33,6.92,91853.85,68127.40,23726.45
Europe,Armenia,Cereal,Online,H,11/24/2014,683458888,12/28/2014,9528,205.70,117.11,1959909.60,1115824.08,844085.52
Sub-Saharan Africa,Eritrea,Cereal,Online,H,3/4/2015,679414975,4/17/2015,2844,205.70,117.11,585010.80,333060.84,251949.96
Europe,Montenegro,Clot
@dvdsmpsn
dvdsmpsn / gist:5c98442e5af17b43858dc110ad424e0f
Last active August 19, 2023 17:56 — forked from alexis89x/broadcast-channel-es6.js
Broadcast Channel API polyfill
/**
@class BroadcastChannel
A simple BroadcastChannel polyfill that works with all major browsers.
Please refer to the official MDN documentation of the Broadcast Channel API.
======
@see <a href="https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API">Broadcast Channel API on MDN</a>
@author Alessandro Piana
@version 1.0.0
@dvdsmpsn
dvdsmpsn / README.md
Last active May 23, 2023 18:49
GatsbyJS compatible IndexNow script for NodeJS

GatsbyJs compatible IndexNow script for NodeJs

Assumes that your deploy script will deploy a fresh sitemap.xml file, so it can get the remote file, parse it and post the results to Bing.

  • Go to https://www.bing.com/indexnow and generate an API Key.
  • Save the key file to https://www.yourdomain.com/*************.txt
  • Add index-now.mjs at scripts/index-now.mjs & npm install -dev cross-fetch xml-js
  • Update host, key and sitemapUrl in scripts/index-now.mjs
  • Add the seo:index-now block to your package.json
  • Add &amp;&amp; npm run seo:index-now at the end of your deploy block
// turns `<h1...h4>Hello world</h1..h4>` into `<h1...h4>Hell🎃 w🎃rld</h1..h4>`
// on halloween only
const now = new Date();
const isHalloween = now.getMonth() === 9 && now.getDate() === 31;
if (isHalloween) {
const h = document.querySelectorAll('h1,h2,h3,h4');
h.forEach(i => i.innerHTML = i.innerHTML.replaceAll('o', '🎃'))
}