Skip to content

Instantly share code, notes, and snippets.

# SSH Agent Functions
# Mark Embling (http://www.markembling.info/)
#
# How to use:
# - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice)
# - Import into your profile.ps1:
# e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes]
# - Enjoy
#
# Note: ensure you have ssh and ssh-agent available on your path, from Git's Unix tools or Cygwin.
@zippy1981
zippy1981 / DisplayImage.ps1
Created May 13, 2011 02:20
Display an image from Windows Powershell
# Loosely based on http://www.vistax64.com/powershell/202216-display-image-powershell.html
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
$file = (get-item 'C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg')
#$file = (get-item "c:\image.jpg")
$img = [System.Drawing.Image]::Fromfile($file);
# This tip from http://stackoverflow.com/questions/3358372/windows-forms-look-different-in-powershell-and-powershell-ise-why/3359274#3359274
@badmotorfinger
badmotorfinger / psmo.ps1
Last active February 12, 2024 00:18
Generates scripts for most SQL Server database objects using PowerShell (SMO objects)
################################################################################################################################
#
# Script Name : SmoDb
# Version : 1.0
# Author : Vince Panuccio
# Purpose :
# This script generates one SQL script per database object including Stored Procedures,Tables,Views,
# User Defined Functions and User Defined Table Types. Useful for versionining a databsae in a CVS.
#
# Usage :
@dataartisan
dataartisan / DevSucks
Created November 16, 2012 22:11
Powershell
function HiSuckyDevs() {
[string]$private:Finger = @"
DQoJICAgICAgICAgLyJcDQoJICAgICAgICB8XC4vfA0KCSAgICAgICAgfCAgIHwNCgkgICAgICAgIHwgICB8DQoJ
ICAgICAgICB8Pn48fA0KCSAgICAgICAgfCAgIHwNCgkgICAgIC8nXHwgICB8LydcLi4NCgkgL35cfCAgIHwgICB8
ICAgfCBcDQoJfCAgID1bQF09ICAgfCAgIHwgIFwNCgl8ICAgfCAgIHwgICB8ICAgfCAgIFwNCgl8IH4gICB+ICAg
fiAgIH4gfGAgICApDQoJfCAgICAgICAgICAgICAgICAgICAvDQoJIFwgICAgICAgICAgICAgICAgIC8NCgkgIFwg
ICAgICAgICAgICAgICAvDQoJICAgXCAgICBfX19fXyAgICAvDQoJICAgIHwtLS8vJydgXC0tfA0KCSAgICB8ICgo
ICs9PSkpIHwNCgkgICAgfC0tXF98Xy8vLS18DQo=
"@
return [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($Finger)) ;
@breezhang
breezhang / demo.ps1
Last active August 3, 2022 20:20
Powershell Generic Collections powershell v3
New-Object System.Collections.ObjectModel.Collection["string"]
# from msdn
#[SerializableAttribute]
#[ComVisibleAttribute(false)]
#public class Collection<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
#
<?php
/**********************
*@file - path to zip file
*@destination - destination directory for unzipped files
*/
function unzip_file($file, $destination){
// create object
$zip = new ZipArchive() ;
// open archive
if ($zip->open($file) !== TRUE) {
@19WAS85
19WAS85 / powershell-web-server.ps1
Last active July 17, 2025 16:44
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@janikvonrotz
janikvonrotz / AdvancedFuntionTemplate.ps1
Created June 10, 2013 15:05
PowerShell: Function Template #PowerShell #CodingStandards
<#
$Metadata = @{
Title = ""
Filename = ""
Description = ""
Tags = ""
Project = ""
Author = "Janik von Rotz"
AuthorContact = "http://janikvonrotz.ch"
CreateDate = "yyyyy-mm-dd hh:mm"
@mintsoft
mintsoft / Forkinator.ps1
Last active May 24, 2023 17:50
Powershell to run a bunch of commands in new processes, wait until they're all done and output all the stdout/stderr. If one of the commands returns non-0 exit code then entire script returns 1
#To add more commands, hack them into the $commands array:
$commands = @(
@{"cmd" = "D:\Documents\Powershell\battwo.bat"; "args" = "yo"},
@{"cmd" = "D:\Documents\Powershell\batone.bat"; "args" = "yo2"}
);
$jobs = @();
foreach($cmd in $commands) {
$startinfo = new-object System.Diagnostics.ProcessStartInfo
$startinfo.FileName = $cmd.cmd;
@zdne
zdne / Google Chrome Incognito.applescript
Last active January 31, 2023 19:38
Google Chrome Incognito – AppleScript to always run chrome in incognito mode. Save as an application to your Application folder. Optionally drag a and drop Google Chrome Icon in between Get Info panes (⌘+I)
if application "Google Chrome" is running then
tell application "Google Chrome" to make new window with properties {mode:"incognito"}
else
do shell script "open -a /Applications/Google\\ Chrome.app --args --incognito"
end if
tell application "Google Chrome" to activate