Skip to content

Instantly share code, notes, and snippets.

View matt40k's full-sized avatar

Matt Smith matt40k

View GitHub Profile
# Get port for instance from C:\Program Files (x86)\Microsoft SQL Server\90\Shared\ASConfig\msmdredir.ini
# Unless you have SQLBrowser running
Invoke-ASCmd -Server 'localhost:49713' -InputFile 'C:\temp\XMLAQuery1.xmla'
# Don't forget to refresh your list in SQL Management Studio!
@matt40k
matt40k / Split_up_SQL_file.ps1
Created March 28, 2017 11:30
Split up SQL file
$InputFile = 'C:\Input.txt'
$outDir = 'C:\Output'
$inputContent = Get-Content $InputFile
foreach ($line in $inputContent)
{
if ($line.Length -gt 0)
{
$firstChar = $line.Substring(0,1)
@matt40k
matt40k / crontab
Last active March 8, 2017 15:22
Updates WordPress on Mythic Beasts's shell web hosting using WP-CLI
# m h dom mon dow command
*/15 * * * * /home/$USER/wp_update.sh >/home/$USER/logs/wplog.txt
@matt40k
matt40k / RemoveMSSQL.sh
Created March 5, 2017 11:35
Manually remove MSSQL from ubuntu when it fails.
sudo apt-get remove mssql-server
sudo rm -rf /var/opt/mssql/
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key remove -
sudo rm /etc/apt/sources.list.d/mssql-server.list
=FormatDateTime(Parameters!DateFrom.Value, DateFormat.ShortDate)
@matt40k
matt40k / tweet.py
Created February 4, 2017 21:59
Tweet using Python
pip install --upgrade pip
pip install tweepy
$today = (Get-Date).ToString('yyyy-MM-dd')
$var = '<ReportParameters><Parameter id=\"1ikmaygI4+fhpdNyAeUC2A==\" subreportfilter=\"True\"><Name>Status</Name><Type>List</Type><PromptText>Status </PromptText><Values><ValidValue><Id>NULL</Id><Code>1</Code><Description>NULL</Description></ValidValue><ValidValue><Id>Further Intervention Required</Id><Code>1</Code><Description>Further Intervention Required</Description></ValidValue><ValidValue><Id>Resolved</Id><Code>1</Code><Description>Resolved</Description></ValidValue><ValidValue><Id>Resolved(1)</Id><Code>1</Code><Description>Resolved(1)</Description></ValidValue><ValidValue><Id>Unresolved</Id><Code>1</Code><Description>Unresolved</Description></ValidValue><ValidValue><Id>Unresolved(1)</Id><Code>1</Code><Description>Unresolved(1)</Description></ValidValue></Values></Parameter><Parameter id=\"mnz1mh+M9RnxwnGABFIBTg==\" subreportfilter=\"True\"><Name>Date</Name><Type>DateRange</Type><PromptText>Date is between</PromptText><Values><DateRange><Start>' + $today + 'T00
Moved here: https://github.com/matt40k/wordpi
@matt40k
matt40k / AdoDotNet.M
Created December 21, 2016 12:55
Simple example of using AdoDotNet in PowerQuery \ M
= AdoDotNet.Query("System.Data.SqlClient", "Data Source=server;Initial Catalog=database", "select 1 a") as table
@matt40k
matt40k / notes.txt
Created December 5, 2016 23:12
Notes on embed
// Register oEmbed providers
function youtube_oembed_provider() {
wp_oembed_add_provider( '#https?://(www.)?youtube.com/watch.*#i', 'http://www.youtube.com/oembed/', true );
}
add_action( 'init', 'youtube_oembed_provider' );
https://generatewp.com/oembed/?clone=jk4nyRY