Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
; Remap Super key to CTRL
LWIN::Ctrl
RWin::Ctrl
Ctrl::LWIN
; Remap Virtual Desktop keys
^Right::^#Right
^Left::^#Left
^Tab::Send #{Tab}
@pythoninthegrass
pythoninthegrass / Documentation.md
Created September 6, 2016 23:49 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
#! /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
@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 / 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 / dscl_create_user
Last active May 11, 2017 16:46
create user on mac os x with dscl command
#!/usr/bin/env bash
# SOURCES:
# https://gist.github.com/rubytester/7330557
# http://stackoverflow.com/a/1923893
# Exit upon failed command
# set -e
@pythoninthegrass
pythoninthegrass / driverautomationtool.ps1
Created June 26, 2017 18:15
driverautomationtool.ps1 - Modified to pass UseBasicParsing parameter. See: http://www.scconfigmgr.com/2017/03/01/driver-automation-tool/
<#
.SYNOPSIS
Driver Automation GUI Tool for Dell,HP,Lenovo,Acer and Microsoft systems
.DESCRIPTION
This script allows you to automate the process of keeping your Dell, Lenovo
and HP drives packages up to date. The script reads the Dell, Lenovo and HP
SCCM driver pack site for models you have specified and then downloads
the corresponding latest driver packs and BIOS updates(Dell only).
.NOTES
FileName: DriverDownloadTool.ps1