Skip to content

Instantly share code, notes, and snippets.

@goyuix
goyuix / user_presets.xml
Created November 11, 2011 22:30
Profile for handbrake that produces MP4 files optimized for viewing on iOS, Android and through the Flash Player
<?xml version="1.0"?>
<ArrayOfPreset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Preset>
<Name>N1</Name>
<Query> -2 -T -O -b 1000 -a 1 -e x264 -6 dpl2 -E faac -B 128 -R Auto -D 0.0 -f mp4 -X 800 -Y 480 -m -x cabac=0:ref=2:me=umh:bframes=0:subme=6:8x8dct=0:weightp=0:trellis=0:analyse=all:no-fast-pskip=1</Query>
<CropSettings>false</CropSettings>
<Version>0.9.5</Version>
</Preset>
</ArrayOfPreset>
@goyuix
goyuix / Merge-Data.ps1
Created July 6, 2012 03:17
Add file size to CSV in PowerShell - merge in size/length from filesystem
gc J:\private\wbfs\DecoderRing.txt |
ConvertFrom-Csv -Delimiter "`t" |
% {
Add-Member -InputObject $_ -MemberType NoteProperty -Name Length -Value (dir $_.ID).Length -Passthru
} | Export-Csv J:\decoder.csv
@goyuix
goyuix / WebMatrixExtension.FileTableService.Hook.cs
Created July 12, 2012 02:42
WebMatrix Import IFileTableService for hooking save events
[Import(typeof(IFileTableService))]
private IFileTableService FileTableService { get; set; }
@goyuix
goyuix / P4-RobustGrep
Created September 19, 2012 16:56
Getting around the "grep revision limit exceeded" in Perforce
# p4 dirs //depot/* returns all the top level folders
#
# % means ForEach-Object, e.g. each top level folder from p4 dirs
#
# -s is to quiet the line length > 4096 noise
# -i is to make it case insensitive
# -e is followed by the search expression
# and the last argument is the path to search
p4 dirs //depot/* | % { p4 grep -s -i -e "search expression" "$_/..." }
@goyuix
goyuix / ResizeWPF.linq
Created November 20, 2012 01:23
WPF Image Resize code for LINQPad
<Query Kind="Statements">
<Reference>&lt;RuntimeDirectory&gt;\System.Xaml.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\WPF\WindowsBase.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\WPF\PresentationCore.dll</Reference>
<Namespace>System.Windows.Media</Namespace>
<Namespace>System.Windows.Media.Imaging</Namespace>
</Query>
var ThumbnailSize = 800;
var source = @"C:\Users\Heather\Pictures\Canon SX230";
@goyuix
goyuix / AddManagedMetadataMapping.ps1
Created December 4, 2012 00:39
script to create a managed property for search that maps to the Active (ows_RoutingEnabled) site column
# Description: script to create a managed property for search that maps to the Active (ows_RoutingEnabled) site column
# Author: Greg McMurray
# History:
# 2012-12-3: Initial version
# a few convenience variables
$YesNo = [Microsoft.SharePoint.Search.Administration.ManagedDataType]::YesNo
$searchApp = Get-SPEnterpriseSearchServiceApplication
# get reference to "Active" property - internally known as ows_RoutingEnabled
@goyuix
goyuix / gist:5351475
Last active December 16, 2015 00:59
Sample script to page in multiple blog pages for easier scrolling
// add in jQuery if it is not loaded
if (!window.jQuery) {
var script = document.createElement('script');
script.type="text/javascript";
script.src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName("head")[0].appendChild(script);
}
function getPosts(page) {
if (window.jQuery == undefined) { return setTimeout(function(){getPosts(page);},100); }
@goyuix
goyuix / Download-File.ps1
Created June 28, 2013 21:24
PowerShell cmdlet to facilitate downloading files
function Download-File {
param(
[Parameter(Mandatory=$true, Position = 0)][string]$Uri,
[Parameter(Mandatory=$false, Position = 1)][string]$SaveAs
)
$loc = [System.IO.Path]::GetFullPath([System.IO.Path]::GetFileName($Uri))
if ($SaveAs) { $loc = [System.IO.Path]::GetFullPath($SaveAs) }
$wc = New-Object System.Net.WebClient
$wc.UseDefaultCredentials = $true
# I just need to add in proper proxy support
@goyuix
goyuix / JHRL Properties JSON
Created August 11, 2013 19:10
Property names mapped to id parameter (index in array) for this URL http://jhrl.com/properties.html?controller=Listings&action=view&id= Maybe add in a function to pull in more rich information (bedrooms, description, photos, etc.) a have an array of objects in the future.
["Aspens Hollyhock 2012- 1BD/1BA Condominium","Teton Manor 4 Bedroom / 3 Bath","","","","","","","","","Aspen House 4BD/2BA","Bailey House 3BD/3BA","Barry House 4BD/3BA","Best House 5BD/3.5BA","Bowie House 3.5BD/3.5BA","Cody House 3.5 Bedroom / 3 Bath","Cody Peak Lodge 4BD/4.5BA","Delphi House 5BD/3.5BA","Granite Ridge Cabin 7590 2BD/2.5 BA","","Granite Ridge Lodge 20 5BD/4.5BA","The Heron House 4BD Plus 2 Lofts/6.5BA","Iron H Lodge at Granite Ridge 6BD/6.5BA","Johnson House 3BD/3BA","Macker's Cabin 5.5BD/5BA","","McBean House 4BD/3.5BA","","","","","Phoenix House 4BD/4BA","The Aspens 1 Bedroom Condominium","The Aspens 2 Bedroom Condominium","","","","Luxury Shooting Star 4 Bedroom Cabin","Steele House 4BD/3.5 BA","Teton Retreat 4 BD/4BA","","","","Tram Tower 3505-4BD/5BA Teton Village Townhome","Tuckaway House 5 BD/3.5BA","Teton Village 1 Bedroom ","Teton Village 2 Bedroom/ 1 bath Condominium","Teton Village 2 Bedroom/ 2 bath Condominium","Teton Village 2 Bedroom Plus Loft Condominium","","","","Teton Villag
javascript:(function ($) {
var pages = 20;
function getPosts(page) {
$.get("page/" + page + "/?rand=" + (new Date()).getTime(), function (d) {
$("#post-wrapper").append($(d).find("div.post-wrapper-hentry"));
if (page + 1 < pages) { getPosts(page + 1); }
});
} if (window.jQuery) { getPosts(2); } else {
var s = document.createElement('script');
s.type = "text/javascript";