Skip to content

Instantly share code, notes, and snippets.

@tywalch
tywalch / bathroomsign.cpp
Created June 1, 2016 08:01
bathroom in use sign
#include <Adafruit_NeoPixel.h>
#define PIN 8
#define NUMPIXELS 12
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int photocellPin = A0; // the cell and 10K pulldown are connected to a0
int photocellReading; // the analog reading from the sensor divider
bool lightStatus = false;
int lightCounter = 0;
@tywalch
tywalch / blythemountainlight.cpp
Last active December 6, 2019 22:06
mountain light
#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/wdt.h>
volatile int f_wdt = 1;
int relayPowerPin = 3; // I supply the relay with 5v power using this pin
int lightSensorPowerPin = 4; // I supply the photoresistor with 5v power using this pin
int relayDataPin = 7; // Output pin for switching relay
int lightDataPin = A2; // Input pin for reading photoresistance
int clockAdjustment; // I use this to manage my delays so things work smoother
#Download this: https://www.microsoft.com/en-us/download/details.aspx?id=35585
Import-Module 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll'
Import-Module 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll'
#OR
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll'
$YOURTENANT = ''
$DIRECTORYSITE = ''
$DIRECTORYNAME = ''
$DIRECTORYDESCRIPTION = ''
USE [Your Database]
GO
CREATE Function [dbo].[CheckHoliday] (@ReferenceDate date)
returns bit
as
BEGIN
DECLARE @Holiday bit
DECLARE @Year int = YEAR(@ReferenceDate)
,@Month int = MONTH(@ReferenceDate)
function Update-VersionNumber {
[CmdletBinding()]
param (
[Parameter(Mandatory=$false, ValueFromPipeline=$true)]
[Alias('define')]
[String]$VersionNumber = "*.*.*.+",
[Parameter(Mandatory=$false)]
[Alias('Current','c')]
[Switch]$CurrentVersion
)
/**********************************************
* Zuul IoT Delegation Manager - ZUULJS.COM
* Example Code
*
* Tyler W. Walch
* TINKERTAMPER.COM [2017]
***********************************************/
/* CONFIGURE SHARED VARIABLES.
* Shared light status variable allows for all functions to react
@tywalch
tywalch / koanexample.js
Last active August 25, 2020 17:03
Koan example in ElectroDB
// Modeling the example posed by Ashwin Bhat in ElectroDB
// https://medium.com/developing-koan/modeling-graph-relationships-in-dynamodb-c06141612a70
const {Entity, Service} = require("electrodb");
const Roles = {
"lead": "500",
"contributor": "400",
"team": "300",
}
@tywalch
tywalch / nodejs_discussion.js
Last active December 4, 2020 14:06
POC Service
/**
* The aim of this exercise is ultimately to inspire communication and be starting place to drive discussion
* on methodology, general approach, and universal best practices. To frame how best to think about this code is
* that it represents a happy path POC, and your task is to use your personal experience to identify and discuss
* improvements, recommendations and potental changes that you'd recommend to get this service production ready.
*
* Please examine this document, familize yourself, come up with any questions you have and ultimately lets meet
* and discuss your thoughts. You don't need to write any code in the meantime.
*
* Note:
@tywalch
tywalch / poc.js
Created August 9, 2021 17:53
PoC Challenge
/**
* The aim of this exercise is ultimately to inspire communication and be starting place to drive discussion
* on methodology, general approach, and universal best practices. To frame how best to think about this code is
* that it represents a happy path POC, and your task is to use your personal experience to identify and discuss
* improvements, recommendations and potental changes that you'd recommend to get this service production ready.
*
* Please examine this document, familize yourself, come up with any questions you have and ultimately lets meet
* and discuss your thoughts. You don't need to write any code in the meantime.
*
* Note:
@tywalch
tywalch / index.js
Created October 28, 2021 03:43
Updating GSIs with strings like it's possible with numbers
const DynamoDB = require("aws-sdk/clients/dynamodb");
const client = new DynamoDB.DocumentClient({
region: "us-east-1",
endpoint: "http://localhost:8000"
});
/**
* withNumbers demonstrates the update of a "composite" gsi sortkey without knowledge of the current
* composite value at the time of update. This works runs without error and operates as expected.
*/