Skip to content

Instantly share code, notes, and snippets.

View jimdiroffii's full-sized avatar
🏠
Working from home

Jim Diroff II jimdiroffii

🏠
Working from home
View GitHub Profile
@jimdiroffii
jimdiroffii / gettrustedhosts.ps1
Last active August 5, 2020 02:17
[Powershell - Check Trusted Hosts] Print the contents of the TrustedHosts file #powershell
Get-Item WSMan:\localhost\Client\TrustedHosts
@jimdiroffii
jimdiroffii / remove-empty-dirs-tail-recurse.ps1
Last active September 14, 2020 14:50
PowerShell Tail Recursion for Removing Empty Directories
$tailRecursion = {
param($Path)
foreach ($childDirectory in Get-ChildItem -Force -LiteralPath $Path -Directory) {
& $tailRecursion -Path $childDirectory.FullName
}
$currentChildren = Get-ChildItem -Force -LiteralPath $Path
$isEmpty = $currentChildren -eq $null
@jimdiroffii
jimdiroffii / flask-dev-startup.script
Created September 14, 2020 14:53
Bash script for setting up and starting a Flask application development server
#! /bin/bash
export FLASK_APP=application.py
export FLASK_DEBUG=1
export FLASK_ENV=development
export FLASK_TESTING=True
flask run --host=0.0.0.0
@jimdiroffii
jimdiroffii / set-default-printer-windows.vbs
Created September 14, 2020 14:57
Map network printers and set default printer in Windows 7
Option Explicit
Dim objNetwork, strLocal
Dim strUNCPrinter1
Dim strUNCPrinter2
Dim strUNCPrinter3
Dim strUNCPrinter4
Dim strUNCPrinter5
Dim strUNCPrinter6
@jimdiroffii
jimdiroffii / set-ip-address-interactive.bat
Created September 14, 2020 14:58
Interactively set an IP address in the CMD line of Windows
@echo off
echo Choose:
echo [A] Set Static IP
echo [B] Set DHCP
echo.
:choice
SET /P C=[A,B]?
for %%? in (A) do if /I "%C%"=="%%?" goto A
for %%? in (B) do if /I "%C%"=="%%?" goto B
@jimdiroffii
jimdiroffii / combine-csv.py
Created September 14, 2020 15:00
Combine multiple CSV files into one file
import os
import glob
import pandas as pd
os.chdir("C:/Users/ishmael/Downloads/csv")
extension = 'csv'
all_filenames = [i for i in glob.glob('*.{}'.format(extension))]
combined_csv = pd.concat([pd.read_csv(f) for f in all_filenames ])
@jimdiroffii
jimdiroffii / copy-filetype.bat
Created September 14, 2020 15:02
Copy files of a certain type
for /R %%x in (*.jpg,*.png) do copy "%%x" C:\<targetdir>
@jimdiroffii
jimdiroffii / remove-kds.bat
Created September 14, 2020 15:15
Remove all KDS services from a Micros Simphony servicehost
rem Stop and Disable KDS Services
net stop "MICROS KDS Controller"
sc config "MICROS KDS Controller" start= disabled
rem Stop and Disable IIS Services
net stop "IISADMIN"
sc config "IISADMIN" start= disabled
net stop "W3SVC"
sc config "W3SVC" start= disabled
@jimdiroffii
jimdiroffii / enable-dhcp.bat
Created September 14, 2020 15:16
Enable DHCP in Windows
rem Setting DHCP for interface "Local Area Connection"
netsh interface ip set address "Local Area Connection" dhcp
netsh interface ip set dns "Local Area Connection" dhcp
@jimdiroffii
jimdiroffii / set-static.bat
Created September 14, 2020 15:17
Set Static IP in Windows
rem Setting Static IP for interface "Local Area Connection"
netsh interface ip set address name = "Local Area Connection" static 192.168.1.1 255.255.255.0 192.168.1.254 1
netsh int ip set dns name = "Local Area Connection" source= static addr = 208.67.220.220
netsh int ip add dns name = "Local Area Connection" addr = 208.67.222.222 index =2