Skip to content

Instantly share code, notes, and snippets.

@andy-s-clark
andy-s-clark / slack-night-mode
Last active March 25, 2019 21:37
Enable night-mode for Slack, using the buildcom fork of slack-night-mode
#!/bin/bash
if [ -f '/usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js' ]; then
target='/usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js'
elif [ -f '/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js' ]; then
target='/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js'
fi
if [ "z${target}" = "z" ]; then
echo 'Unsupported platform or Slack is not installed'
@andy-s-clark
andy-s-clark / lock_screen
Created April 2, 2017 07:31
Hack to change HipChat status to away when locking screen
#!/bin/bash
# Hack to change HipChat status to away when locking screen. This could be less
# hacky by connecting to hipchat using the "--message" option. However, this
# option only appears to support "about", "logout", "quit" and "wakeup"
#
# Tested in KDE (Kubuntu 16.10)
#
# Change HipChat status to away -> Lock screen -> Change HipChat status to
# available after screen is unlocked
@andy-s-clark
andy-s-clark / foreman_yaml.py
Created July 17, 2015 16:11
Convert Foreman YAML to Puppet hiera yaml
#!/usr/bin/env python
## USAGE
# ./foreman_yaml.py < myserver.foreman.yaml > myserver.puppet.yaml
## Convert Foreman YAML:
# classes:
# build_environment_vars:
# env_vars: SERVER_ENVIRONMENT=development
# build_java:
#!/usr/bin/python
import logging
import json
import argparse
from kazoo.client import KazooState
from kazoo.client import KazooClient
logging.getLogger('kazoo.client').addHandler(logging.StreamHandler())
<!--- Option A --->
<cfloop index="trailItemIndex" from="0" to="#trailItemsCount - 1#">
<cfset trailItem = trailItems.get(trailItemIndex) />
<!--- Only list the first and last category,
with an ellipsis in the middle if more than two --->
<cfif trailItemIndex GT 0>
<span class="breadcrumb-delimiter">&gt;</span>
</cfif>
<cfif (trailItemIndex EQ 0) OR (trailItemIndex EQ (trailItemsCount-1))>
<cfset trailItemLink = request.utility.makeLink(link = "/" &
@andy-s-clark
andy-s-clark / index.js
Last active December 30, 2015 07:29
Simple node.js application to show headers
var http = require ('http');
var webServer = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'application/json'});
res.end(JSON.stringify(req.headers));
}).listen(8050);
@andy-s-clark
andy-s-clark / async_map_demo.js
Last active December 27, 2015 17:49
Find folders matching the pattern themes/{theme}/assetnodes/{site} using NodeJS
/**
* Demo to find folders matching the pattern themes/{theme}/assetnodes/{site}
* Requires running `npm install async`
* Runs both using sync and async calls
* @TODO More error checking
*/
var fs = require('fs');
var async = require('async');