Skip to content

Instantly share code, notes, and snippets.

@bhasto
bhasto / OptionalWithValue.java
Created March 21, 2015 00:02
OptionalWithValue - Hamcrest matcher for values wrapped in Java 8 Optional
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
import java.util.Optional;
import static org.hamcrest.core.IsEqual.equalTo;
public class OptionalWithValue<T> extends TypeSafeDiagnosingMatcher<Optional<? extends T>> {
@bhasto
bhasto / Sony Bravia 2014.xml
Last active November 25, 2015 19:35
Plex Profile for Sony Bravia 2014
<?xml version="1.0" encoding="utf-8"?>
<Client name="Sony Bravia 2014">
<Identification>
<Header name="X-AV-Client-Info" regex=".*KDL-\d{2}[WR][5689]\d{2}B.*" />
<DeviceDescription>
<Manufacturer substring="Sony" />
<FriendlyName regex="KDL-\d{2}[WR][5689]\d{2}B.*" />
</DeviceDescription>
</Identification>
<DeviceDescription>
@bhasto
bhasto / clean-db.ps1
Last active February 21, 2017 07:56
SQL Server - Drop all tables in given schema using Powershell
sqlps -Command {
Invoke-Sqlcmd -ServerInstance "SERVER[,PORT]" -Database DB_NAME -Username sa -Password sa -Variable "SchemaName='dbo'" -InputFile "clean-db.sql"
}