Skip to content

Instantly share code, notes, and snippets.

View micdenny's full-sized avatar

Michael Denny micdenny

View GitHub Profile
@micdenny
micdenny / iframe-tracker.component.html
Last active March 25, 2024 20:20
How to detect a click event on a cross domain iframe (iframe.tracker)
<div>
<iframe appIframeTracker (iframeClick)="onIframeClick()" src="http://www.google.com"></iframe>
</div>
@micdenny
micdenny / Configuring Windows PowerShell remoting.md
Created March 27, 2015 11:31
Configuring Windows PowerShell remoting

Enabling PowerShell remoting on the server

Open PowerShell console and type the following command to enable PowerShell remoting:

Enable-PSRemoting -Force

Change scripts execution policy to allow remote scripts:

Set-ExecutionPolicy RemoteSigned
@micdenny
micdenny / super-mario.ino
Created May 5, 2017 20:57
Super Mario theme song w/ piezo buzzer and Arduino!
/*
Arduino Mario Bros Tunes
With Piezo Buzzer and PWM
Connect the positive side of the Buzzer to pin 3,
then the negative side to a 1k ohm resistor. Connect
the other side of the 1 k ohm resistor to
ground(GND) pin on the Arduino.
by: Dipto Pratyaksa
@micdenny
micdenny / BusExtensions.cs
Last active March 19, 2019 17:29
EasyNetQ BusExtensions ConnectionAwaiter
public static class BusExtensions
{
public static Task ConnectionAwaiter(this IBus bus)
{
var cts = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
bus.Advanced.Connected += (s, e) =>
{
cts.TrySetResult(true);
};
#! /usr/bin/env python
import posixpath
import argparse
import urllib
import os
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
@micdenny
micdenny / redis-ha-manual-failover.md
Last active May 28, 2018 13:31
Redis - High Availability - Manual Failover

Waiting until the support for slave-read-only on StackExchange.Redis, I would like to share my solution to fail-over a node with a minimum write interruption, maintaining data consistency, reducing (eliminating?) possible false write acknowledgment (on the node that is failing). You can lose some write because there's a window where both nodes are slaves. I feel that you can still have some false write ack because you can receive an ack while setting the master as slave and that write could be lost.

redis-slaveof-kvs01.txt

MULTI
SLAVEOF kvs01 6379
CONFIG REWRITE
PUBLISH "__Booksleeve_MasterChanged" "*"
EXEC
@micdenny
micdenny / EasyNetQ-Template.cs
Last active April 3, 2018 14:48
EasyNetQ LINQPad Template
void Main()
{
var stopHandle = new ManualResetEventSlim();
var consumer = new Thread(() =>
{
var bus = RabbitHutch.CreateBus("host=localhost", x => x.Register<IEasyNetQLogger>(s => new EasyNetQ.Loggers.ConsoleLogger()));
bus.RespondAsync<MyRequest, MyResponse>(async request =>
{
@micdenny
micdenny / MessageService.ts
Last active January 24, 2018 18:23 — forked from KeithGillette/MessageService.ts
Simple AngularJS 1.X TypeScript Message Bus
import * as angular from 'angular';
import { Observable, Subject, Subscription } from '@reactivex/rxjs';
export interface Message {
channel: Function;
content: any;
}
/**
* @description AngularJS service singleton implementing simple publish/subscribe message bus to provide decoupled communication of commands & events
@micdenny
micdenny / Program.cs
Last active January 5, 2018 16:15
BinaryData: how to manage an optional property using ReadObject
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Newtonsoft.Json;
using Syroot.BinaryData;
using Syroot.BinaryData.Extensions;
namespace ConsoleApp1
@micdenny
micdenny / star-wars.ino
Last active May 5, 2017 21:00 — forked from eznj/star_wars.ino
Arduino Star Wars Song for Piezo
const int c = 261;
const int d = 294;
const int e = 329;
const int f = 349;
const int g = 391;
const int gS = 415;
const int a = 440;
const int aS = 455;
const int b = 466;