Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
#! /bin/bash
#script to change all desktop backgrounds
echo -n “Drag and drop an image file here then press ‘return’ or
press ‘control-c’ to cancel…”
read -e WLPR;
function change_wallpaper
{
defaults write com.apple.desktop Background “{default = {ImageFilePath=’$WLPR’; };}”; killall Dock
}
change_wallpaper
#!/bin/bash
# Fedora64 Ubuntu64 Ubuntu32 Fedora32
OS='Ubuntu64'
DEB=('Ubuntu' 'elementary OS' 'Lubuntu')
RPM=('Fedora' 'Centos')
DIST='Lubuntu'
SCRAPELINK='https://plex.tv/downloads?channel=plexpass'
SCRAPESTR='data-event-action="Linux" data-event-category="Download-Media-Server'
declare -A array
declare $(curl -sk $SCRAPELINK |grep -i "$SCRAPESTR" | awk 'BEGIN { FS = "\"" } { print "array["$10"]="$2""}')
@pythoninthegrass
pythoninthegrass / wsus_client.ps1
Created January 11, 2017 23:49 — forked from trodemaster/wsus_client.ps1
Register Windows Server 2012 r2 to wsus server via registry keys
New-Item -Path "HKLM:Software\Policies\Microsoft\Windows\WindowsUpdate"
New-Item -Path "HKLM:Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
Set-ItemProperty -Path "HKLM:\software\policies\Microsoft\Windows\WindowsUpdate" -Name WUServer -Value "http://wsus.domain.com:8530" -Type String -force
Set-ItemProperty -Path "HKLM:\software\policies\Microsoft\Windows\WindowsUpdate" -Name WUStatusServer -Value "http://wsus.domain.co:8530" -Type String -force
Set-ItemProperty -Path "HKLM:\software\policies\Microsoft\Windows\WindowsUpdate\AU" -Name UseWUServer -Value "1" -Type DWORD -force
# commit docker image (container then repo/image:tag)
docker commit centos jollygoodhorsepower/centos-ps:latest
# stop all containers:
docker kill $(docker ps -q)
# remove all containers
docker rm $(docker ps -a -q)
# remove all docker images
@pythoninthegrass
pythoninthegrass / logparser.ps1
Created March 24, 2017 17:27 — forked from exp0se/logparser.ps1
Logparser log parsing
# Logparser
###############
# Security Log
###############
# Find Event id
& 'C:\Program Files (x86)\Log Parser 2.2\LogParser.exe' -stats:OFF -i:EVT "SELECT * FROM 'Security.evtx' WHERE EventID = '5038'"
#Security log
#============
####
#4624 - Logon & Logoff events successful
#4625 - Logon unsucceful
####
# Get usernames
Get-WinEvent -path .\Security.evtx | Where {$_.id -eq "4624"} | Foreach {([xml]$_.ToXml()).GetElementsByTagName("Data").ItemOf(5)}| Select -ExpandProperty "#text" -Unique
# Get domains
@pythoninthegrass
pythoninthegrass / Set-ProfileForDocker.ps1
Last active January 10, 2021 05:50 — forked from sixeyed/Set-ProfileForDocker.ps1
PowerShell aliases for working with Docker on Windows - save to $profile. Ignore PoshGit and Chocolatey if neither is installed.
Rename-Item Function:\Prompt PoshGitPrompt -Force
function Prompt() {if(Test-Path Function:\PrePoshGitPrompt){++$global:poshScope; New-Item function:\script:Write-host -value "param([object] `$object, `$backgroundColor, `$foregroundColor, [switch] `$nonewline) " -Force | Out-Null;$private:p = PrePoshGitPrompt; if(--$global:poshScope -eq 0) {Remove-Item function:\Write-Host -Force}}PoshGitPrompt}
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
# Docker Module
@pythoninthegrass
pythoninthegrass / get_ip_address.sh
Created April 3, 2017 16:15
Taken from n8felton's setHostname.sh code. Very clever use of route, awk, and ipconfig getifaddr.
# Source: https://github.com/n8felton/Mac-OS-X-Scripts
# Find an active network interface
interface=$(route get 0.0.0.0 2>/dev/null | awk '/interface: / {print $2}')
# If ${interface} wasn't set, we probably don't have an internet connection
# Exit now because we're not going to talk to DNS like this.
if [[ -z "${interface}" ]]; then
exit 1
fi
@pythoninthegrass
pythoninthegrass / remove_mcafee.sh
Last active October 29, 2020 22:18 — forked from mikedamm/gist:d0ef2291a3c4eecdc35a
Remove McAfee Agent and McAfee Endpoint Security for Mac
#!/usr/bin/env bash
# See McAfee KBs:
# https://kc.mcafee.com/corporate/index?page=content&id=KB88461 # Remove ENS for Mac (ENSM)
# https://kc.mcafee.com/corporate/index?page=content&id=KB61125 # Remove McAfee Agent
# Exit upon failed command
# set -e
for i in 3des-cbc aes128-cbc aes128-ctr aes128-gcm@openssh.com aes192-cbc aes192-ctr aes256-cbc aes256-ctr aes256-gcm@openssh.com arcfour arcfour128 arcfour256 blowfish-cbc cast128-cbc chacha20-poly1305@openssh.com rijndael-cbc@lysator.liu.se; do dd if=/dev/zero bs=1000000 count=1000 2> /dev/null | ssh -c $i localhost "(time -p cat) > /dev/null" 2>&1 | grep real | awk '{print "'$i': "1000 / $2" MB/s" }'; done