Skip to content

Instantly share code, notes, and snippets.

View slmcmahon's full-sized avatar

Stephen McMahon slmcmahon

View GitHub Profile
@slmcmahon
slmcmahon / jmp.js
Created February 9, 2019 01:25
JIMP example
const Jimp = require("jimp");
let data = "Dev";
if (process.argv.length > 2) {
data = process.argv[2];
}
var fileName = 'ic_launcher.png';
var imageCaption = `[${data}]`;
@slmcmahon
slmcmahon / PIR_LCD.ino
Created November 21, 2018 17:16
Arduino Mini Motion Sensor with LCD
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Connection details for LCD:
// SDA --> A4
// SCL --> A5
// VCC --> 5V
// lcd is initialized with
@slmcmahon
slmcmahon / bumpversion.sh
Created August 26, 2018 18:49
Appends to or overwrites version in info.plist file.
#!/bin/bash
# the 'defaults' command wants the plist file path, but without the .plist extension
NOEXT=$(echo "$1" | cut -f 1 -d '.')
# extract the current CFBundleVersion value
VERSION=$(defaults read $NOEXT CFBundleVersion)
# get the number of '.' characters in the version
DOTCOUNT=$(echo $VERSION | awk -F"." '{print NF-1}')
@slmcmahon
slmcmahon / SecurityUtils.cs
Created August 9, 2018 20:56
MD5 Hashing
using System;
using System.IO;
using System.Security.Cryptography;
namespace Security
{
public class SecurityUtils
{
public static string ComputeChecksum(string filePath)
{
@slmcmahon
slmcmahon / SerializationUtils.cs
Last active July 29, 2018 19:53
Helper for XML and JSON Serialization / Deserialization
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using System.Xml;
using System.Runtime.Serialization;
@slmcmahon
slmcmahon / UserList.js
Last active November 16, 2017 02:39
Simple Example of Loading Data in React
import React, { Component } from 'react'
export class UserList extends Component {
constructor() {
super();
this.state = {
users: [],
}
};
@slmcmahon
slmcmahon / Person.cs
Last active August 6, 2021 08:59
Azure Table Storage CRUD example
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
using System;
using System.Collections.Generic;
using System.Linq;
namespace AzureTableSample
{
public class Person : TableEntity
@slmcmahon
slmcmahon / ServerResponse.cs
Created August 5, 2017 12:48
Generic server response wrapper
using System;
namespace AzureDemo.Models
{
public class ServerResponse
{
public ServerResponse()
{
Success = true;
}
@slmcmahon
slmcmahon / chron_most_popular.py
Created October 28, 2016 04:17
Show a listing of links to the most popular Houston, TX stories in the Houston Chronicle.
@slmcmahon
slmcmahon / FindExtendedASCIIChars
Created September 23, 2014 16:33
Reports the index of any characters in a string where the ASCII value is greater than 127
declare
@test nvarchar(500),
@idx int,
@c nchar(1)
set @idx = 1
set @test = 'Nå er tiden for alle gode menn til å komme til unnsetning for landet sitt.'
while @idx < LEN(@test)
begin