Skip to content

Instantly share code, notes, and snippets.

View brazilnut2000's full-sized avatar

Jon Crowell brazilnut2000

View GitHub Profile
@brazilnut2000
brazilnut2000 / Powershell add Active Directory Module.ps1
Last active August 8, 2022 15:08
How to install the AD Module for Powershell
#How to install the Active Directory module for Powershell
#Source: https://blogs.technet.microsoft.com/ashleymcglone/2016/02/26/install-the-active-directory-powershell-module-on-windows-10/
# Download the script referenced in the post and follow the directions
@brazilnut2000
brazilnut2000 / GlobalAutohotkey.ahk
Last active September 28, 2015 15:42
AHK: Default autohotkey script. This should grow substantially over time as I begin to use autohotkey more.
; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a
; semicolon, such as this one, are comments. They are not executed.
; This script has a special filename and path because it is automatically
; launched when you run the program directly. Also, any text file whose
; name ends in .ahk is associated with the program, which means that it
; can be launched simply by double-clicking it. You can have as many .ahk
; files as you want, located in any folder. You can also run more than
; one .ahk file simultaneously and each will get its own tray icon.
@brazilnut2000
brazilnut2000 / Dapper Scalar Query.cs
Created August 17, 2015 20:46
Dapper: Execute Scalar query
int value = conn.Query<int>(sql, args).Single();
string value = conn.Query<string>(sql, args).Single();
http://stackoverflow.com/questions/8050636/is-there-an-executescalar-in-dapper
@brazilnut2000
brazilnut2000 / Dapper Stored Procedure
Last active August 29, 2015 14:24
Call SQL Server stored procedure using Dapper from C# console app
class Program
{
public static SqlConnection GetOpenConnection()
{
var dapperConnString = ConfigurationManager.ConnectionStrings["DapperConn"].ConnectionString;
var connection = new SqlConnection(dapperConnString);
connection.Open();
return connection;
}
@brazilnut2000
brazilnut2000 / Generate scripts for database.ps1
Last active August 29, 2015 14:21
Powershell: Generate scripts for database
<#
SOURCE: https://www.simple-talk.com/sql/database-administration/automated-script-generation-with-powershell-and-smo/
See script options and defaults in comment block at end of file
or look here for the official list:
https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.scriptingoptions.aspx
Override any defaaults you want in the script below
#>
$Filepath='E:\MyScriptsDirectory' # local directory to save build-scripts to
$DataSource='MyServer' # server name and instance
$Database='MyDatabase'# the database to copy from
@brazilnut2000
brazilnut2000 / SSAS Extended Events Template.xml
Last active September 26, 2022 10:19
SSAS: XMLA template script to configure Extended Events for Analysis Services
<!-- This script supplied by Bill Anton http://byobi.com/blog/2013/06/extended-events-for-analysis-services/ -->
<!-- Blog post on how to use this: http://markvsql.com/2014/02/introduction-to-analysis-services-extended-events/ -->
<Create
xmlns="http://schemas.microsoft.com/analysisservices/2003/engine"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2"
xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2"
xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100"
xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200"
xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300">
@brazilnut2000
brazilnut2000 / CreateDirIfNeeded
Last active August 29, 2015 14:19
VBA: Creates a directory if it doesn't exist
Sub TestCreateDirIfNeeded()
Dim path As String
path = "C:\imarealboy"
CreateDirIfNeeded (path)
End Sub
Sub CreateDirIfNeeded(path As String)
On Error Resume Next
MkDir path
On Error GoTo 0
@brazilnut2000
brazilnut2000 / Speed up Video
Last active August 29, 2015 14:17
JS: Speed up html5 video playback
// run the following from the console
document.getElementsByTagName('video')[0].playbackRate=2
@brazilnut2000
brazilnut2000 / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@brazilnut2000
brazilnut2000 / Boxstarter Dev Machine.ps1
Last active June 28, 2018 18:05
Boxstarter: Set up dev machine
# https://stackoverflow.com/questions/29873439/how-do-i-update-all-chocolatey-apps-without-confirmation/30428182#30428182
# tldr: choco feature enable -n=allowGlobalConfirmation
cinst launchy
cinst ditto
cinst beyondcompare
cinst instanteyedropper
cinst 7zip
cinst linqpad
cinst cmder