Skip to content

Instantly share code, notes, and snippets.

View mikebridge's full-sized avatar
🤔
Thinking

Mike Bridge mikebridge

🤔
Thinking
  • M Bridge Canada Consulting Ltd.
  • Edmonton, Canada
  • 03:27 (UTC -06:00)
View GitHub Profile
@mikebridge
mikebridge / less.rake
Created May 14, 2012 22:50
Compile less on windows via dotless & albacore
##
## Compile the .less files into .css
##
def to_win(file)
file.gsub(%r{/}) { "\\" }
end
def to_unix(file)
file.gsub(%r{\\}) { "/" }
# find who added C# Tests in Test Directories, ordered by date
git ls-tree --name-only -z -r HEAD| egrep -i -z -Z -E '(Tests\..*\.*cs)$' | xargs -0 -n1 git blame --show-name -w | grep "\[Test" | grep -v TestFixture | perl -pe 's/^[^\(]+\((\w+\s*\w*)\s+(\d{4}-\d{2}-\d{2}).*/$2 $1/' | sort -n
# find who added JS Specs, ordered by date
git ls-tree --name-only -z -r HEAD| egrep -i -z -Z -E '(\.spec\.js)$' | xargs -0 -n1 git blame --show-name -w | grep "it\(" | perl -pe 's/^[^\(]+\((\w+\s*\w*)\s+(\d{4}-\d{2}-\d{2}).*/$2 $1/' | sort -n
@mikebridge
mikebridge / CsvFormatter.cs
Last active August 29, 2015 14:04
CsvMediaTypeFormatter.cs
using System;
using System.Text;
namespace BridgeCanada.Utils.Csv
{
/// <summary>
/// Summary description for CsvFormatter.
/// </summary>
public class CsvFormatter
{
@mikebridge
mikebridge / takephoto.sh
Created May 19, 2015 20:04
take a photo on raspberry pi
#!/bin/bash
PIDMOTION=$(pgrep -x motion)
if [ -n "$PIDMOTION" ]
then
echo "stopping motion"
sudo /etc/init.d/motion stop
fi
@mikebridge
mikebridge / resize.sh
Created May 19, 2015 20:09
Resize images on raspberry pi
#!/bin/bash
find ./ -name '*.jpg' -exec convert -resize 1900x1425 -interlace Plane -quality 50% \{\} ../motion/\{\}.jpg \;
#!/bin/sh
# based on http://stackoverflow.com/questions/9998710/can-it-possible-to-send-mails-by-bash-script-via-smtp#answer-10001357
# example:
#
# $ ./bashmail.sh -h=smtp.example.com \
# -s="My Subject" \
# -t=me@example.com \
# -f=you@example.com \
# -z="My Name" \
@mikebridge
mikebridge / HexConversions.scala
Created November 16, 2016 20:27
Helper functions for Coursera Cryptography I (https://www.coursera.org/learn/crypto)
import javax.xml.bind.DatatypeConverter
/**
* Implicit conversions and helpers for the Coursera crypto course,
* mainly to extend String types so they can be used as hex strings
*
* ==Usage==
*
* {{{
* import HexConversions._
@mikebridge
mikebridge / HelloWorld.java
Created January 19, 2017 20:55
Hello World
public static void main(String[] args){
System.out.println("Hello World");
}
// Adapted from https://github.com/ThomasLengeling/KinectPV2/blob/master/KinectPV2/examples/PointCloudDepth/PointCloudDepth.pde
KinectPV2 kinect;
int maxD = 4500; // 4.5m
int minD = 0; // 50cm
void setup() {
size(1024, 424, P3D);
using System;
using System.Diagnostics.CodeAnalysis;
using Akka.Actor;
using EchoAPI.Messages;
using Microsoft.AspNet.SignalR.Owin;
namespace EchoAPI.Hub
{
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
public class EchoHub : Microsoft.AspNet.SignalR.Hub