Skip to content

Instantly share code, notes, and snippets.

@samdark
samdark / github-post-receive.php
Last active October 11, 2019 10:05
Simple GitHub post-receive PHP hook
<?php
function cidr_match($ip, $ranges)
{
$ranges = (array)$ranges;
foreach($ranges as $range) {
list($subnet, $mask) = explode('/', $range);
if((ip2long($ip) & ~((1 << (32 - $mask)) - 1)) == ip2long($subnet)) {
return true;
}
}
@tomorgan
tomorgan / UCMA UserEndpoint Sending IM Example.cs
Created March 4, 2013 17:14
Simplest example using UCMA UserEndpoint to send an IM. Note: no error handling, assumes IM always accepted etc. For learning only :)
using Microsoft.Rtc.Collaboration;
using System;
namespace SimpleUserUCMA
{
class Program
{
private const string sipaddress = "sip:from@domain.com";
private const string username = "USERNAME";
private const string password = "PASSWORD";
@stuartleeks
stuartleeks / ConvertFromDocker.ps1
Last active October 31, 2019 18:52
ConvertFrom-Docker
function PascalName($name){
$parts = $name.Split(" ")
for($i = 0 ; $i -lt $parts.Length ; $i++){
$parts[$i] = [char]::ToUpper($parts[$i][0]) + $parts[$i].SubString(1).ToLower();
}
$parts -join ""
}
function GetHeaderBreak($headerRow, $startPoint=0){
$i = $startPoint
while( $i + 1 -lt $headerRow.Length)