Skip to content

Instantly share code, notes, and snippets.

@matt2005
matt2005 / add-function-with-param.ps1
Created June 23, 2017 09:17 — forked from sayedihashimi/add-function-with-param.ps1
PowerShell: Add a function with a parameter to an object
$result | Add-Member -MemberType ScriptMethod ExpandString -Value {
[cmdletbinding()]
param(
[Parameter(
Mandatory=$true)]
[string]
$unexpandedValue
)
process{
if($this.ProjectInstance){
@matt2005
matt2005 / Attiny85_batteryMonitor.ino
Created March 18, 2017 21:24 — forked from dwhacks/Attiny85_batteryMonitor.ino
Attiny battery monitor with tiny core.
/*
Attiny85_batteryMonitor
Ideas borrowed from: https://github.com/unixbigot/Flat-Mate
modified for arduino tiny core by DWhacks
*@@ Voltage trigger levels.
*
@matt2005
matt2005 / configuration
Created January 13, 2016 23:22 — forked from carmolim/configuration
My last configuration.yaml file for my Home Assistant setup (HA, HASS)
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: ******
longitude: ******
# C for Celcius, F for Fahrenheit
temperature_unit: C
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: America/Sao_Paulo
homeassistant:
name: Home
latitude: <LATITUDE>
longitude: <LONGITUDE>
# C for Celcius, F for Fahrenheit
temperature_unit: C
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: Europe/Copenhagen
customize:
device_tracker.mads_desktop:
@matt2005
matt2005 / configuration.yaml
Created January 13, 2016 23:16 — forked from tomduijf/configuration.yaml
Home Assistant configuration
#################################################################
## Main and component setup
#################################################################
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: [REDACTED]
longitude: [REDACTED]
# C for Celcius, F for Fahrenheit
Import-Module WebAdministration
$port = 80
$ssl = $false
#App Start
SetupOptionalVariables
SetupAppPools
SetupWebSite
SetupWebApplication
@matt2005
matt2005 / psxaml.ps1
Last active August 29, 2015 14:24 — forked from sunnyone/psxaml.ps1
Add-Type -AssemblyName presentationframework
[xml]$XAML = @'
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="100" Width="20">
<StackPanel>
<TextBox Name="textWeather" />
<Button Name="buttonGet" Content="Get"/>
# Finish headless installation via `ssh [email protected]`
# See /boot/config.txt
sudo apt-get update && sudo apt-get --purge dist-upgrade
sudo raspi-config
# Add locale en.us-utf8 (but keep en.gb-utf8)
sudo dpkg-reconfigure locales
# Timezone
sudo dpkg-reconfigure tzdata
# Update firmware
#!/usr/bin/env python2.7
# script by Alex Eames http://RasPi.tv
# explained here...
# http://raspi.tv/2013/controlled-shutdown-duration-test-of-pi-model-a-with-2-cell-lipo
# DO NOT use this script without a Voltage divider or other means of
# reducing battery voltage to the ADC. This is exaplained on the above blog page
import time
import os
import subprocess
import smtplib
ALTER PROCEDURE [dbo].[TempGetStateItem3]
@id tSessionId,
@itemShort tSessionItemShort OUTPUT,
@locked bit OUTPUT,
@lockAge int OUTPUT,
@lockCookie int OUTPUT,
@actionFlags int OUTPUT
AS
DECLARE @textptr AS tTextPtr, @length AS int, @extendExpiration bit, @now AS datetime = GETUTCDATE();