Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@emarte91
emarte91 / WSBScraper.py
Last active August 24, 2022 23:37
WSB Scaper Work in progress
import praw
import pandas as pd
import yfinance as yf
import datetime as dt
from psaw import PushshiftAPI
#Global Variables
api = PushshiftAPI()
reddit_read_only = praw.Reddit(client_id="",
client_secret="",
@emarte91
emarte91 / ADBulkCreation.ps1
Created November 1, 2018 01:37
Create multiple Active Directory accounts with a csv
Import-Module ActiveDirectory
Import-Csv \\Pathname\ADbulk.csv | ForEach-Object {
$firstName = $_.firstname
$lastName = $_.lastname
$name = $firstName + ' ' + $lastName
$samAccountName = $firstName[0] + $lastName
$userPrincipal = $samAccountName + "@companyname.com"
$ouPath = "OU=Base,OU=Sites,DC=rome,DC=local"
$password = (ConvertTo-SecureString "Password1" -AsPlainText -Force)
$enable = $true
@emarte91
emarte91 / SalaryPaycheckCalculator.py
Last active October 8, 2018 20:34
Calculates weekly, biweekly, and monthly salary only for 2 states. AZ and NY
def calculations():
salary = int(input("What is your yearly salary?"))
state = input("What state are you in? Choose a number \n 1: AZ \n 2: NY\n:")
states = {'1': .83, '2': .73}
state_tax = states.get(state)
weekly = int((salary / 52) * state_tax)
monthly = int((salary / 12) * state_tax)
biweekly = weekly * 2
print("Weekly: $" + str(weekly) + "\nMonthly: $" + str(monthly) + "\nBiWeekly: $" + str(biweekly))
new_calculation = input("Would you like to calculate another salary? Y/N:")
@emarte91
emarte91 / PasswordResetToolGUI.ps1
Created September 15, 2018 03:36
Basic AD password reset tool with a simple GUI
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
Function MakeNewForm {
$PWTool.Close()
$PWTool.Dispose()
MakeForm
}
Function Search {
@emarte91
emarte91 / PasswordResetTool.ps1
Created September 15, 2018 04:14
Resets AD user account passwords and unlocks accounts.
Write-Host "Password Reset and Unlock Tool`n" -ForegroundColor Yellow
$User = Read-Host "Enter in a Username"
try{
Get-ADuser $User -properties * | select Name,LockedOut,Enabled,@{n='Password Last Reset';e={$_.PasswordLastSet}},@{n="Job Title";e={$_."Description"}},@{n='Email';e={$_."EmailAddress"}},TelephoneNumber,Office | fl
$Name = (Get-ADUser $User -Properties Name).name
}
catch{
Write-Warning "$User is incorrect or does not exist.`nTry again"
\\FileOfYourScript.ps1
@emarte91
emarte91 / CreateADUser.ps1
Last active September 12, 2018 09:05
Basic AD account creator | Modify to your environment needs
$firstName = Read-Host "What is the users first name?"
$lastName = Read-Host "What is the users last name?"
# Default username setting is first letter of first name and full last name Ex: John Smith = Jsmith
$recommendedUser = $firstName[0] + $lastName
#Password set to "Password1" feel free to change
$password = (ConvertTo-SecureString -AsPlainText "Password1" -Force)
$fullName = "$firstName $lastName"
@emarte91
emarte91 / OUUserSearch.ps1
Created September 11, 2018 04:03
Find AD users in a specific OU
$OU = 'ou=TestOU,dc=Company,dc=local'
Get-ADUser -Filter * -SearchBase $OU | Select Name,Samaccountname
@emarte91
emarte91 / WebStatusMon.py
Created August 29, 2018 16:07
Checks website status code
import requests
import time
import datetime
while True:
r = requests.get("https://thinktreeit.com")
if r.status_code != 200:
print(f'Down Status Code:{r.status_code} {datetime.datetime.now()}')
time.sleep(5)
else:
@emarte91
emarte91 / ScriptMenu.ps1
Last active September 7, 2018 07:39
Organize your scripts in a simple menu
Write-Host "Main Menu`n`nChoose an option"
$Option = Read-Host "1: Password Reset Script`n2: Exchange Email Creator`n:"
Switch($Option)
{
1 {"Opening Password script"; \\FilePathHere}
2 {"Opening Exchange script";\\FilePathHere}
default {"Incorrect option try again"; \\MainMenu.ps1 }
}
@emarte91
emarte91 / GetExternalIP.ps1
Created September 4, 2018 20:08
One line script to get your external IP address
Invoke-RestMethod ipinfo.io | Select ip