Skip to content

Instantly share code, notes, and snippets.

View cnromaine's full-sized avatar

cn cnromaine

  • cn romaine & associates
View GitHub Profile
@cnromaine
cnromaine / BuildingGuiApplicationInPowerSheel .ps
Last active December 21, 2015 06:59
From http://www.drdobbs.com/windows/building-gui-applications-in-powershell/240049898?pgno=2The Search-Twitter function returns an array of PowerShell objects with properties from the Twitter query. From that data, we extract the text of the tweet and the URL pointing to the Twitter user's profile image. If you look closely at the PowerShell cod…
Import-Module .\ShowUI
function Search-Twitter ($q) {
$wc = New-Object Net.Webclient
$url = http://search.twitter.com/search.rss?q=$q
    ([xml]$wc.downloadstring($url)).rss.channel.item | select *
}
 
$ws = @{
    WindowStartupLocation = "CenterScreen"
    Width = 500
$path = (get-location).path
$files = get-childitem | where {$_.extension -eq ".bak"}
foreach($file in $files)
{
$dbPath = $path + '\' + $file
$dbName = $file.ToString().Replace(".bak", "")
write-host "Adding" $dbPath "to db " $dbName
Restore-SqlDatabase -ServerInstance "writeyourserverinstancehere" -Database $dbName -BackupFile $dbPath
}
@cnromaine
cnromaine / gist:bd8a85059d41e652fc3079e6f8b75efd
Created March 1, 2018 04:23
Run Embedded C# Pad on a web page
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Embedded C# Pad code example</title>
</head>
<body>
<pre>
<code class="codepad language-csharp" data-codepad="theme:cobalt" style="width:100%;height:400px;" >//