Skip to content

Instantly share code, notes, and snippets.

View robertcatgithub's full-sized avatar

Robert Chin robertcatgithub

View GitHub Profile
function Invoke-ParameterisedSqlQuery {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string] $ConnectionString,
[Parameter(Mandatory)]
[string] $Query,
[Parameter(ValueFromPipeline)]
[PSCustomObject[]] $QueryArgs
)
@jdhitsolutions
jdhitsolutions / settings.json
Last active May 15, 2022 05:13
My Windows Terminal settings file.
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command":
{
"action": "copy",
"singleLine": false
},
@martin-guth
martin-guth / exportReport.ps1
Last active March 13, 2022 08:27
Complete PowerShellScript for exporting Reports to Excel using ImportExcel
#exportReport.ps1
<#
.SYNOPSIS
Takes a query from a SQL file, adds parameters to it, executes it on a SQL Server and writes the result into an Excel file. Return value 0 indicates successful execution, Return value -1 indicates errors.
.DESCRIPTION
This script enables exporting query results to excel from a machine, where Excel is not installed.
This is done leveraging the module ExcelPSLib.
System requirements:
- Powershell version 3 or greater with modules dbatools and ImportExcel installed
@mikepsn
mikepsn / excelapp.py
Created January 15, 2015 09:37
Interacting with Microsoft Excel from Python using the Win32 COM API (Example Python Code)
"""
An example of using PyWin32 and the win32com library to interact
Microsoft Excel from Python.
This can be used instead of Visual Basic for Applications (VBA)
(c) Michael Papasimeon
"""
import win32com.client
@hlawrenz
hlawrenz / csv2json.py
Created June 6, 2014 14:47
A bunch of csv related python scripts.
#!/usr/bin/env python
import argparse
import csv
import sys
from collections import OrderedDict
import simplejson as json
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active June 28, 2024 10:38
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@diyan
diyan / gist:2850866
Created June 1, 2012 09:54
Python with PowerShell Remoting (Windows equivalent for Unix ssh sessions)
# Note that target_env.login and target_env.password is global variables
# Maybe I should add this into Fabric project (http://docs.fabfile.org/en/1.4.2/index.html).
# This is complicated task for sure but it would be nice if Fabric could use ssh under Linux and PowerShell Remoting under Windows.
def remote_sh(target_host, command_text, ignore_error=False):
print('run PowerShell script block at {0}: {1}'.format(target_host, command_text))
command_text = command_text.replace('"', '\'')