Skip to content

Instantly share code, notes, and snippets.

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();
@matt2005
matt2005 / gist:a6a8d2ab18e763584a66
Created December 7, 2014 00:56
Get-WUInstall_proxy.ps1
Function Get-WUInstall
{
<#
.SYNOPSIS
Download and install updates.
.DESCRIPTION
Use Get-WUInstall to get list of available updates, next download and install it.
There are two types of filtering update: Pre search criteria, Post search criteria.
- Pre search works on server side, like example: ( IsInstalled = 0 and IsHidden = 0 and CategoryIds contains '0fa1201d-4330-4fa8-8ae9-b877473b6441' )
#!/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
# Finish headless installation via `ssh pi@192.168.2.x`
# 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
@matt2005
matt2005 / Remote Desktop URL Handler
Created June 30, 2015 12:15
Remote Desktop URL Handler
#Enables use of RDP://servername to open in mstsc
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
Try {New-Item -Path HKCR:rdp -erroraction stop}
Catch {Remove-Item -Path HKCR:rdp -recurse -ErrorAction SilentlyContinue
New-Item -Path HKCR:rdp -ErrorAction SilentlyContinue}
Finally {$rdp=Get-childitem -Path HKCR:rdp}
Try {New-ItemProperty -LiteralPath HKCR:rdp -name '(Default)' -Value "URL:Remote Desktop Protocol <URL:Remote%20Desktop%20Protocol> " -erroraction stop}
Catch {Set-ItemProperty -LiteralPath HKCR:rdp -name '(Default)' -Value "URL:Remote Desktop Protocol <URL:Remote%20Desktop%20Protocol> " -ErrorAction SilentlyContinue}
Try {New-ItemProperty -LiteralPath HKCR:rdp -name 'EditFlags' -Type DWORD -Value "2" -erroraction stop}
Catch {Set-ItemProperty -LiteralPath HKCR:rdp -name 'EditFlags' -Type DWORD -Value "2" -ErrorAction SilentlyContinue}
@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"/>
#==============================================================================================
# XAML Code - Imported from Visual Studio Express 2013 WPF Application
#==============================================================================================
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
[xml]$XAML = @'
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="OS Details" Height="306" Width="525" WindowStartupLocation="CenterScreen" WindowStyle="None" ResizeMode="NoResize">
<Grid Margin="0,0,-0.2,0.2">
@matt2005
matt2005 / ChocoInstall.ps1
Created July 14, 2015 11:00
ChocolateyInstaller With Proxy setup
# ==============================================================================
#
# Fervent Coder Copyright 2011 - Present - Released under the Apache 2.0 License
#
# Copyright 2007-2008 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at
#
Import-Module WebAdministration
$port = 80
$ssl = $false
#App Start
SetupOptionalVariables
SetupAppPools
SetupWebSite
SetupWebApplication
// pumpOnInterval turn pump on for x
const unsigned long pumpOnInterval = (30 * 1000);
// pumpOffInterval turn pump off for x
const unsigned long pumpOffInterval = (60*60*1000);
// Which pins are connected to which LED/Pump
const byte pumpPin = 0;
const byte ledPin = 1;
// Variable holding the timer value so far. One for each "Timer"
unsigned long pumpTimer;