Skip to content

Instantly share code, notes, and snippets.

View hackerman518's full-sized avatar

Anon hackerman518

  • The World
View GitHub Profile
@hackerman518
hackerman518 / download_zip.ps1
Created December 30, 2019 00:27 — forked from edeustace/download_zip.ps1
powershell script to download zip and copy items from the zip to locations on destination file
# copy items
# if you have a zip here: http://myserver.com/my.zip and it contains myFile.txt and myFolder/myOtherFile.txt
# you can call this script like so:
# .\download_zip.ps1 http://myserver.com/my.zip "myFile.txt|c:\myFileDestination\myFileHere.txt" "myFolder/myOtherFile.txt|c:\myOtherDestination\myOtherFile.txt"
#
"download script -----------------------------------------"
"------"
"Downloads from the given url, unzips it then for each string arg, copies the file to the destination"
@hackerman518
hackerman518 / DangItBobby.ps1
Created October 7, 2019 22:36 — forked from danieltharp/DangItBobby.ps1
PowerShell script to find where a user is logged into on the network and disable their NIC.
# ********************************************************************************
#
# Script Name: DangItBobby.ps1
# Version: 1.0.0
# Author: bluesoul <https://bluesoul.me>
# Date: 2016-04-06
# Applies to: Domain Environments
#
# Description: This script searches for a specific, logged on user on all or
# specific Computers by checking the process "explorer.exe" and its owner. It
@hackerman518
hackerman518 / DangItBobby.ps1
Created October 7, 2019 22:36 — forked from danieltharp/DangItBobby.ps1
PowerShell script to find where a user is logged into on the network and disable their NIC.
# ********************************************************************************
#
# Script Name: DangItBobby.ps1
# Version: 1.0.0
# Author: bluesoul <https://bluesoul.me>
# Date: 2016-04-06
# Applies to: Domain Environments
#
# Description: This script searches for a specific, logged on user on all or
# specific Computers by checking the process "explorer.exe" and its owner. It
@hackerman518
hackerman518 / Upload.ps1
Created October 2, 2019 17:58 — forked from harnerdesigns/Upload.ps1
A PowerShell script to upload via FTP a directory one file at a time. I basically got tired of having to open FileZilla and wait for it to connect and then waiting for everything to upload.
#Directory To Pull Files From
$Dir="C:\foo\bar\toBeUploaded"
#FTP site and credentials
$ftp = "ftp://ftp.somesite.com/"
$user = "user"
$pass = "pass"
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)
@hackerman518
hackerman518 / Upload.ps1
Created October 2, 2019 17:58 — forked from harnerdesigns/Upload.ps1
A PowerShell script to upload via FTP a directory one file at a time. I basically got tired of having to open FileZilla and wait for it to connect and then waiting for everything to upload.
#Directory To Pull Files From
$Dir="C:\foo\bar\toBeUploaded"
#FTP site and credentials
$ftp = "ftp://ftp.somesite.com/"
$user = "user"
$pass = "pass"
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)

Credit: Mark Kraus
Website: https://get-powershellblog.blogspot.com

Collection Type Guidence

When to use what

  • Use Arrays if you know the element types and have a fixed length and/or known-up-front collection size that will not change.
  • Use ArrayList if you have an unkown collection size with either unknown or mixed type elements.
  • Use a Generic List when know the type of the elements but not the size of the collection.
  • Use a HashTable if you are going to do key based lookups on a collection and don't know the object type of the elements.
  • Use a Dictionary<TKey, TValue> you are going to do key based lookups on a collection and you know the type of the elements.
  • Use a HashSet when you know the type of elements and just want unique values and quick lookups and assignmnets.
@hackerman518
hackerman518 / SFTP-Upload.ps1
Created June 24, 2019 05:57 — forked from AdamDimech/SFTP-Upload.ps1
Upload files to an SFTP server via PowerShell
#Upload files to an SFTP server via PowerShell
#Requires WinSCP to be installed on local machine
# Load WinSCP .NET assembly
Add-Type -Path "C:\path\to\WinSCPnet.dll"
# Password prompt (not obscured)
[void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
$title = 'Credentials'
@hackerman518
hackerman518 / Script-Template-WithCreds.ps1
Created June 12, 2019 18:08 — forked from davefunkel/Script-Template-WithCreds.ps1
PowerShell Script Template with Saved Creds
<#
.SYNOPSIS
The synopsis goes here. This can be one line, or many.
This version of the template has inbuilt functions to capture credentials and store it securely for reuse
Avoids the need to have plaintext passwords in the script
.DESCRIPTION
The description is usually a longer, more detailed explanation of what the script or function does.
Take as many lines as you need.
@hackerman518
hackerman518 / BoxPrompt2.ps1
Created February 1, 2019 05:52 — forked from jdhitsolutions/BoxPrompt2.ps1
A variation on my PowerShell box prompt. This should work cross-platform on PowerShell Core.
#requires -version 5.1
<#
This is a variation of the BoxPrompt code you can find at https://gist.github.com/jdhitsolutions/df808116f9234c070bdaf233418ec59b
Create a lined box with user and location information. The line color will indicate if the user is running elevated.
The prompt will also display the current date and time and a PS prompt with the PowerShell version.
┌───────────────────────┐
│ [BOVINE320\Jeff] C:\ │
@hackerman518
hackerman518 / osx_bootstrap.sh
Created January 9, 2019 22:52 — forked from codeinthehole/osx_bootstrap.sh
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)