Skip to content

Instantly share code, notes, and snippets.

View jongalloway's full-sized avatar

Jon Galloway jongalloway

View GitHub Profile
@jongalloway
jongalloway / Channel9Downloader.ps1
Last active September 14, 2022 12:50 — forked from DerAlbertCom/Channel9Downloader.ps1
PowerShell Scripts for Downloading Channel 9 Videos
<#PSScriptInfo
.VERSION 1.3
.AUTHOR jongalloway@gmail.com
.GUID da220b4e-e889-42dc-85cd-91e0f91a965e
.PROJECTURI https://gist.github.com/jongalloway/935780
.RELEASENOTES
1.2 adds regular expression title match (thanks, @meavk)
1.3 adds check for / at end of RSS URL
#>
@jongalloway
jongalloway / LiveWriterLookup.cs
Created May 19, 2011 23:53
Retrieving Live Writer account credentials via LiveWriter API
//Source: Last comment at http://lozanotek.com/blog/archive/2007/07/22/Using_The_Windows_Live_Writer_API_To_Retrieve_Your_Blog_Password.aspx
using System;
using Microsoft.Win32;
// Add a ref to C:\Program Files\Windows Live\Writer\WindowsLive.Writer.BlogClient.dll
using WindowsLive.Writer.BlogClient;
// Add a ref to C:\Program Files\Windows Live\Writer\WindowsLive.Writer.CoreServices.dll
using WindowsLive.Writer.CoreServices.Settings;
using WindowsLive.Writer.CoreServices;
using System;
using System.Diagnostics;
using System.Net;
namespace ConsoleApplication1 {
internal class Program {
private const int COUNT = 20;
private static void Main() {
var urls = new[] {
@jongalloway
jongalloway / DynamicModelcontroller.cs
Created May 27, 2011 00:17
ASP.NET MVC - Dynamic Model w/ Mono compiler as a service
using System.IO;
using System.Reflection;
using System.Web.Mvc;
using Mono.CSharp;
using System;
namespace DynamicModelCompilation.Controllers
{
public class HomeController : Controller
{
@jongalloway
jongalloway / trigger-based-auditing.sql
Created November 28, 2011 20:50
Trigger based auditing for SQL Server - http://bit.ly/sql-auditing
USE MYAWESOMEDATABASE
GO
IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 'Audit')
CREATE TABLE Audit
(
AuditID [int]IDENTITY(1,1) NOT NULL,
Type char(1),
TableName varchar(128),
PrimaryKeyField varchar(1000),
# --- settings ---
$feedUrlBase = "http://go.microsoft.com/fwlink/?LinkID=206669"
# the rest will be params when converting to funclet
$latest = $true
$overwrite = $false
$top = 500 #use $top = $null to grab all
$destinationDirectory = join-path ([Environment]::GetFolderPath("MyDocuments")) "NuGetLocal"
# --- locals ---
$webClient = New-Object System.Net.WebClient
@jongalloway
jongalloway / download-entries.ps1
Created November 29, 2011 21:38 — forked from mattpodwysocki/download-entries.ps1
Download entries from NuGet
# --- settings ---
$feedUrlBase = "http://go.microsoft.com/fwlink/?LinkID=206669"
# the rest will be params when converting to funclet
$latest = $true
$overwrite = $false
$top = 5000 #use $top = $null to grab all
$destinationDirectory = join-path ([Environment]::GetFolderPath("MyDocuments")) "NuGetLocal"
# --- locals ---
$webClient = New-Object System.Net.WebClient
@jongalloway
jongalloway / RecursiveReplace.ps
Created December 29, 2011 07:56
Recursive replace in files (PowerShell)
$find = 'jquery-1\.4\.4'
$replace = 'jquery-1\.5\.1'
$match = '*.cshtml' , '*.vbhtml'
$preview = $true
foreach ($sc in dir -recurse -include $match | where { test-path $_.fullname -pathtype leaf} ) {
select-string -path $sc -pattern $find
if (!$preview) {
(get-content $sc) | foreach-object { $_ -replace $find, $replace } | set-content $sc
}
@jongalloway
jongalloway / feeds-rss2.php
Created January 7, 2012 00:17
Lame hack in WordPress feeds-rss2.php to work around Feedburner's 512K limit. I later moved this into a plugin, Excerpt Old Posts (in the WordPress plugins directory)
<?php
/**
* RSS2 Feed Template for displaying RSS2 Posts feed.
*
* @package WordPress
*/
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
$more = 1;
@jongalloway
jongalloway / sublime_text.bat
Created January 26, 2012 03:04
Chocolatey - launching apps via PowerShell
if not "%*" =="" SET args = "-argumentlist \"%*\"
powershell -command "start-process -filepath \"..\lib\sublimetext2.2.0.2165\tools\sublime_text.exe\" %args%"