Skip to content

Instantly share code, notes, and snippets.

View ciaranj's full-sized avatar

Ciaran Jessup ciaranj

View GitHub Profile
@ciaranj
ciaranj / agent notification blueprint.yaml
Last active April 10, 2024 19:43
Enhanced Home Assistant Notification Blueprint
# Derived from https://gist.github.com/allenporter/e70d9eb090c7dbdd593cf526e07b4abe with extensions from the comment thread applied
blueprint:
name: Daily Conversation Agent Agenda Notification
description: |
Conversation agent generates a personalized notification based on the
upcoming calendar agenda, birthday reminders, location, and weather information in your language.
domain: automation
input:
notify_time:
name: Notification time
@ciaranj
ciaranj / calculate-contains-window.js
Created January 24, 2019 13:06
Gist to calculate the properties of an image that has been scaled/positioned through the CSS object-fit and object-position properties
function calculateContainsWindow(image) {
var imageComputedStyle = window.getComputedStyle(image);
var imageObjectFit = imageComputedStyle.getPropertyValue("object-fit");
var coordinates = {};
var imagePositions = imageComputedStyle.getPropertyValue("object-position").split(" ");
var naturalWidth = image.naturalWidth;
var naturalHeight= image.naturalHeight;
if( image.tagName === "VIDEO" ) {
naturalWidth= image.videoWidth;
Verifying my Blockstack ID is secured with the address 1FKAVZYEV9TbLRm77y4t4Kv5KjAirKeK46 https://explorer.blockstack.org/address/1FKAVZYEV9TbLRm77y4t4Kv5KjAirKeK46

Keybase proof

I hereby claim:

  • I am ciaranj on github.
  • I am ciaranj (https://keybase.io/ciaranj) on keybase.
  • I have a public key whose fingerprint is 78D2 F339 7EEA 212A 6A2E E69B EC67 0DBF AAB2 1C44

To claim this, I am signing this object:

@ciaranj
ciaranj / SampleCeresStatsdConfig
Created February 23, 2014 10:46
Sample ceres statsd config for woody.
/*
Required Variables:
port: StatsD listening port [default: 8125]
Graphite Required Variables:
(Leave these unset to avoid sending stats to Graphite.
Set debug flag and leave these unset to run in 'dry' debug mode -
@ciaranj
ciaranj / gist:9056285
Created February 17, 2014 18:32
A *working* (on Windows) UDP Multicast client & server with Node.Js v0.10.25 (I spent a *LOT* of time getting EINVAL and I still don't quite know why :/)
For my own sanity ;) Scraped from a variety of places, including: http://stackoverflow.com/questions/14130560/nodejs-udp-multicast-how-to?utm_medium=twitter&utm_source=twitterfeed
!Server
var news = [
"Borussia Dortmund wins German championship",
"Tornado warning for the Bay Area",
"More rain for the weekend",
"Android tablets take over the world",
"iPad2 sold out",
@ciaranj
ciaranj / .bashrc
Created February 14, 2013 11:21
A .bashrc suitable for use with msysgit to utilise ssh-agent to avoid repeated passphrase addition, taken verbatim from: http://mah.everybody.org/docs/ssh
#! /bin/bash
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
@ciaranj
ciaranj / gist:2991314
Created June 25, 2012 21:16
OpenSSH Release.sh
#!/bin/sh
cd "$(dirname "$0")" && . ../common/update-lib.sh
#check_pristine
package=openssh
version=6.0p1
url=http://mirror.bytemark.co.uk/OpenBSD/OpenSSH/portable/
@ciaranj
ciaranj / gist:1308792
Created October 24, 2011 11:14 — forked from juamei/gist:1308791
atmosphere_resource_reusage
Suspicious log entries:
2011-10-24 10:42:39.203 -> Entered ChatPollerHandler with queryString : ajax_timeout=-1&pollSeqId=10&poll=true&sessionId=86ee4d9b-a696-4d92-b1ce-d73dcb27616c&chatWindowId=35ac44a9-fb2f-434b-bae8-4fda524cb491&handle=null&participantId=ca1e9956-b419-411f-b306-10d2d20e3ff6&seq=1, EVT_RSC: 26961876
2011-10-24 10:42:39.203 -> Entered ChatPollerHandler with queryString : ajax_timeout=-1&pollSeqId=10&poll=true&sessionId=e87ede08-b7c2-4b47-8332-7050f1e3944a&chatWindowId=d3e35f7b-11ca-463a-836b-aa7e918aac59&handle=null&participantId=7b8bd5ba-bc8a-4a3a-b310-8cd97f94d933&seq=1, EVT_RSC: 26961876
Relevant code:
public void onRequest(AtmosphereResource<HttpServletRequest, HttpServletResponse> resource) throws IOException {
@ciaranj
ciaranj / gist:1234827
Created September 22, 2011 13:55
Seemingly working HTTP(s) userstream connection.
var sys= require('sys');
var OAuth= require('oauth').OAuth;
oa= new OAuth("https://twitter.com/oauth/request_token",
"https://twitter.com/oauth/access_token",
yourConsumerKey, yourConsumerSecret,
"1.0A", "http://localhost:3000/oauth/callback", "HMAC-SHA1");
var request= oa.get("https://userstream.twitter.com/2/user.json", yourAccessToken, yourTokenSecret );
request.addListener('response', function (response) {
response.setEncoding('utf8');