Skip to content

Instantly share code, notes, and snippets.

View fearthecowboy's full-sized avatar
🏠
Happily Working from home

Garrett Serack fearthecowboy

🏠
Happily Working from home
View GitHub Profile
@fearthecowboy
fearthecowboy / profiles.json
Last active August 7, 2019 22:40
My Terminal profiles.json
{
"globals": {
"alwaysShowTabs": true,
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44b0}",
"initialCols": 160,
"initialRows": 50,
"keybindings": [
{
"command": "closePane",
"keys": [
@fearthecowboy
fearthecowboy / peek.ps1
Created June 18, 2019 18:04
quick peek
-HttpPipelineAppend { param($req, $callback, $next )
Write-Host -fore white "Inserted my code in the http pipeline on the way to:`n $($req.RequestUri)."
Write-Host -fore yellow "`n---------------------`n Before We Go!`n---------------------"
Write-host -fore white "Request Headers:";
$($req.Headers) |% { if ($_.Key -ne "Authorization") { Write-host -nonewline -fore cyan " $($_.Key): "; Write-Host -fore green "$($_.Value)" } }
# call the next step in the Pipeline
@fearthecowboy
fearthecowboy / install.ps1
Last active February 27, 2019 17:35
Setup Test Sandbox for AutoRest
Set-ExecutionPolicy -Scope LocalMachine Unrestricted -force
$ProgressPreference=0
function ResolvePath {
param (
[string] $FileName
)
$FileName = Resolve-Path $FileName -ErrorAction SilentlyContinue `
-ErrorVariable _frperror
@fearthecowboy
fearthecowboy / new-alias.ps1
Created February 1, 2019 00:48
A better new-alias for PowerShell
<#
.SYNOPSIS
Creates a new alias. Better than original New-Alias
.DESCRIPTION
Creates a new Function Alias. Unlike the original New-Alias, this will let you
create an alias that can be a command line or script, in a single command.
@fearthecowboy
fearthecowboy / switch.h
Last active December 9, 2018 06:04
Switch device
#pragma once
#include "device.h"
// this device represents a switch that can be open or closed.
class Switch : public Device {
protected:
// the pin the switch is connected to.
const uint8_t pin;
public:
@fearthecowboy
fearthecowboy / blinker.h
Created December 9, 2018 05:52
Blinker Device
#pragma once
#include "device.h"
// our Blinker class, just blinks a light on and off on continually.
class Blinker : public Device {
private:
bool state = false;
public:
// constructor -- pass in the interval for flipping the light.
@fearthecowboy
fearthecowboy / setup.cpp
Last active December 9, 2018 05:37
Setup Arduino sketch
// Setup the sketch.
void setup() {
// we're going to spit some messages out to the serial port.
Serial.begin(19200);
// create the device instances
// blink on and off every two seconds.
bc = new Blinker(2000);
@fearthecowboy
fearthecowboy / app.cpp
Last active December 9, 2018 05:14
State-machine Arduino example
// include references to the devices that we'd like to use
#include "blinker.h" // an automated blinker
#include "switch.h" // a device that supports events for a switch (ie, closed, open)
#include "freeMemory.h" // an automated poller that reports teh free memory back to the serial console.
// Handy for debugging and seeing how much memory is getting sucked up.
// First, declare the states we want in our state machine:
States( starting, processing, cleanup ); // these can be anything you'd like.
@fearthecowboy
fearthecowboy / simplest.cpp
Created December 9, 2018 04:50
Simple Arduino Example
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
@fearthecowboy
fearthecowboy / Append.ps1
Created July 30, 2018 16:40
HttpPipelineAppend
Get-Redis -HttpPipelineAppend { param($req, $callback, $next )
Write-Host -fore white "Inserted my code in the http pipeline on the way to:`n` $($req.RequestUri)."
Write-Host -fore yellow "`n---------------------`n Before We Go!`n---------------------"
Write-host -fore white "Request Headers:";
$($req.Headers) |% { if ($_.Key -ne "Authorization") { Write-host -nonewline -fore cyan " $($_.Key): "; Write-Host -fore green "$($_.Value)" } }
# call the next step in the Pipeline