Skip to content

Instantly share code, notes, and snippets.

@rwilkes
rwilkes / server_setup.sh
Last active August 29, 2015 14:06 — forked from deepakkumarnd/server_setup.sh
Sample shell script for initial configuration and hardening of a debian-based dev server.
echo "* Updating system"
apt-get update
apt-get -y upgrade
echo "* Installing packages"
apt-get -y install build-essential libmagickcore-dev imagemagick libmagickwand-dev libxml2-dev libxslt1-dev git-core nginx redis-server curl nodejs htop
id -u deploy &> /dev/null
if [ $? -ne 0 ]
then
@rwilkes
rwilkes / search_grammar.txt
Last active August 29, 2015 14:08 — forked from evernotegists/search_grammar.txt
Evernote Formal Search Grammar
search = [ notebook , separator ] ,
[ "any:" , separator ] ,
term ,
{ separator , term } ;
notebook = "notebook:" , ( word | quoted ) ;
word = wordchar , { wordchar } ;
quoted = '"' , { ( any - '"' ) | '\"' } , '"' ;
@rwilkes
rwilkes / Get-SqlBlob.ps1
Created January 29, 2015 22:47
Simple POSH script to connect to SQL server and stream some table BLOBS a buffer to be reconstituted as proper files!
Function Select-TableBlob {
param(
[string]$connectionString="Initial Catalog=Anaqua;Data Source=HFX.anaqua.local;Trusted_Connection=True;",
[string]$sqlQuery="SELECT OriginalFile, ThumbNailBlob, ThumbNailBlob FROM FileInformation WHERE ((ThumbNailBlob IS NOT NULL) and (substring(convert(varchar(max),convert(varbinary(max),ThumbNailBlob)), 0, 3) like 'BM'))",
[string]$tableName,
[string]$blobColumn,
[string]$destination=(Get-Location | Split-Path),
[int]$blobLimit=10
)
[System.Data.SqlClient.SQLConnection]$connection = New-Object System.Data.SqlClient.SQLConnection
@rwilkes
rwilkes / ShowSessionState.ps1
Last active August 29, 2015 14:26 — forked from AndySchneiderDev-zz/ShowSessionState.ps1
PowerShell Session State Demonstration
function Show-SessionStateDemo
{
[CmdletBinding()]
param (
[Parameter()]
$Server,
[Parameter()]
$Database,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export3.dtd">
<en-export export-date="20130730T205637Z" application="Evernote" version="Evernote Mac">
<note>
<title>Test Note for Export</title>
<content>
<![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
Hello, World.
@rwilkes
rwilkes / Powershell.csx
Created March 15, 2016 16:18 — forked from jamessantiago/Powershell.csx
MMBot script for use with the MMBot.Powershell package
//Notes:
//Requires the MMBot.Powershell nuget package
//Output objects must either support a ToString method or be a string to display properly
//It is recommended to use the PowershellModule script instead of this one to control what is executed
using MMBot.Powershell;
var robot = Require<Robot>();
robot.Respond(@"(ps|powershell) (.*)", msg =>
@rwilkes
rwilkes / PowershellModule.csx
Last active March 22, 2017 06:02 — forked from jamessantiago/PowershellModule.csx
MMBot script for use with the MMBot.Powershell package
//Notes:
//Requires the MMBot.Powershell nuget package
//Specify the powershell scripts folder using the MMBOT_POWERSHELL_SCRIPTSPATH key in the ini file
//Powershell scripts must be .psm1 (modules) to be executed
//Only scripts inside the scripts folder may be executed using this script
//Output objects must either support a ToString method or be a string to display properly
using MMBot.Powershell;
var robot = Require<Robot>();
@rwilkes
rwilkes / longpathsample1.cs
Created December 1, 2016 14:46 — forked from Yecats/longpathsample1.cs
Long Path Support Sample 1
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version=".NETFramework,Version=v4.6.2"/>
</startup>
</configuration>
@rwilkes
rwilkes / longpathsample2.cs
Created December 1, 2016 14:49 — forked from Yecats/longpathsample2.cs
Long Path Sample 2
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version=".NETFramework,Version=v4.5.2"/>
</startup>
<runtime>
<AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false" />
</runtime>
</configuration>
@rwilkes
rwilkes / StartTransferFile.ps1
Created January 22, 2017 04:23
BITS File Transfer Script Transfer file/s between file or web servers using BITS (Background Intelligent Transfer Service)
<# 
   .Synopsis 
    Transfer file/s between file or web servers using BITS (Background Intelligent Transfer Service) 
   .Description 
    This script transfers a file between a file or web server to another file location using BITS. 
    Parameters can specify the Source Server, the Destination Server and the Credentials for the connection. 
    By the usage of wildcard for the Source Server location multiple files can be transferred. 
   .Example 
    Start-TransferFile.ps1 -s "\\serverS\share\file.ext" -d "\\serverD\share" -c "domain\user" 
    Transfers the file "file.ext" from source server "\\serverS\share\" to destination server "\\serverD\share"