Skip to content

Instantly share code, notes, and snippets.

View DominicWatson's full-sized avatar

Dominic Watson DominicWatson

View GitHub Profile
@DominicWatson
DominicWatson / Dockerfile
Last active November 16, 2023 14:55
A first hacky go at a script to help with zero-downtime cluster autoscaler downsizing of nodes (where you have deployments with only 1 replica)
View Dockerfile
FROM bitnami/kubectl as kubectl
FROM ubuntu
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/
COPY scripts/* /usr/bin/
RUN chmod +x /usr/bin/k8sdrain.sh && chmod +x /usr/bin/job.sh
CMD [ "/usr/bin/job.sh" ]
@DominicWatson
DominicWatson / Pixl8CLA.md
Last active February 27, 2020 09:45
Pixl8 Group CLA
View Pixl8CLA.md

Pixl8 Group CLA

Contributor License Agreement

The document below clarifies the terms under which You (the copyright owner or legal entity authorized by the copyright owner), may make "The Contributions" (software, bug fixes, configuration changes, documentation, or any other materials) to "The Work" (Pixl8 Group Open Source projects on Github including Preside, Preside extensions and other CFML modules). This license protects You, Pixl8 Group and licensees; it does not change your rights to use your own contributions for any other purpose.

You and Pixl8 Group agree:

  • You grant to Pixl8 Group a non-exclusive, irrevocable, worldwide, royalty-free, sublicenseable, relicenseable, transferable license under all of Your relevant intellectual property rights, to use, copy, prepare derivative works of, distribute and publicly perform and display "The Contributions" on any licensing terms, including without limitation: (a) open source licenses like the GNU General Public (v2.0) license; and (b) binary, propri
View RoundingProblem.cfm
<cfscript>
writeOutput( Int( 720.00000000000000000000000000000252 ) );
</cfscript>
@DominicWatson
DominicWatson / a2dp.py
Last active March 7, 2017 18:27 — forked from pylover/a2dp.py
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
View a2dp.py
#! /usr/bin/env python3.5
"""
####################################################################
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Vahid Mardani
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
View gist:d6ce9527fa3294b286cc
<cfscript>
struct function stripNonDataNgAndJsAttributes( required struct attributes ) {
var patternToKeep = "^((data|ng)\-|on)\S";
return attributes.filter( function( key, value ){
return key.reFindNoCase( patternToKeep );
} );
}
string function structToQueryString( required struct input ) {
@DominicWatson
DominicWatson / gist:0ba1fee4a5ae62d967fa
Created February 2, 2016 15:15
Another number comparison joyfulness
View gist:0ba1fee4a5ae62d967fa
<cfscript>
dump( '8e2597' == '8e2140' );
</cfscript>
@DominicWatson
DominicWatson / gist:7cc1e1280f9b70c96dfa
Created June 4, 2015 12:37
Filter member function on strings in Lucee 4.5+
View gist:7cc1e1280f9b70c96dfa
<cfscript>
mystring = "my string";
result = mystring.filter( function( part ){
echo( part );
return part != 'my';
}, " " );
echo( result );
</cfscript>
@DominicWatson
DominicWatson / Wirebox.cfc
Last active August 29, 2015 14:07
Wirebox.cfc with explicit wiring configuration
View Wirebox.cfc
component extends="coldbox.system.ioc.config.Binder" output=false {
public void function configure() output=false {
map( "myService" )
.to( "services.MyService" )
.asSingleton()
.noAutowire()
.initArg( name="someSetting", value=settings.mySetting )
.initArg( name="somecache", dsl="cachebox:myCache" );
@DominicWatson
DominicWatson / tabs and spaces
Last active December 25, 2015 21:39
Example code to show tabs and spaces being used for indentation and alignment. To see why tabs don't work for alignement (and spaces do), go into edit mode and change the indent size setting. Watch how the first example breaks and the second does not. The second examples show the advantage of TABS for INDENTATION without breaking alignment when …
View tabs and spaces
<!--- TABS FOR BOTH INDENTATION *AND* ALIGNMENT --->
<cfquery>
select column_a,
column_b,
columb_c
from some_table
inner join another_table on another_table.id = some_table.another_table
</cfquery>
@DominicWatson
DominicWatson / gist:1211688
Created September 12, 2011 16:27
Some code to make color customization in ColdFusion 9's cfspreadsheet implementation clean
View gist:1211688
<cfscript>
void function spreadsheetSetCustomPalette(required any workbook, required struct palette){
var customPalette = arguments.workbook.getworkbook().getcustompalette();
var color = "";
var colorIndex = 0;
var rgb = "";
for(color in palette){
try{
colorIndex = CreateObject("java", "org.apache.poi.hssf.util.HSSFColor$#UCase( color )#").GetIndex();