Skip to content

Instantly share code, notes, and snippets.

View matthewbodaly's full-sized avatar

Matthew matthewbodaly

View GitHub Profile

About a week ago my Internet dropped right before we were going to go on vacation. This is how I got probably the worst possible bandaid to fix it.

background

I live in a building thats been around since the '60s. I have a cable Internet connection where the wire is older than my kids ages combined. Usually every few weeks, the Internet will have a few minutes of complete packet drops and then recover. This time, it was down for over 15 minutes. This happened right before we were about to leave on vacation so I did the bare minimum of "turning it on again" and reseating connections. No dice. This would have to wait until after I was back from the trip.

post vacation

After getting back from vacation, I contacted our ISP who walked me through... resetting the connection and ... reseating wires, still didn't work so a tech was scheduled. In the meantime, the kids kept asking for the Internet to be setup so I fired up the hotspot we used on trips. This works fine, but I really didn't want to reconfigure e

@matthewbodaly
matthewbodaly / Generated Random Number.xml
Last active October 7, 2021 08:52
Testingwithrandomnumbrers.md
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute>
<displayName>Generated Random Number</displayName>
<description>This will view the generated random number</description>
<dataType>string</dataType>
<scriptContentsMac>#!/bin/bash&#13;
# Generate a random number. This is used best when you want break up computers into groups for testing.&#13;
# Use with a reporting app to read the number and sort your computers&#13;
# For an example of that, refer to:&#13;
# https://gist.github.com/matthewbodaly/7a6cfabb74d896ca609bca9f62226463&#13;
#&#13;
#!/bin/bash
# For a good time, run Time Machine over VPN.
# yourfuneral
# snapshot
tmutil snapshot
# disable Time Machine
tmutil disable
exit 0
@matthewbodaly
matthewbodaly / emailtosam.ps1
Created March 15, 2019 04:28
Thanks StackOverflow
# your funeral
# This isn't original to me
# https://stackoverflow.com/questions/47035953/how-to-get-samaccountname-from-an-e-mail-using-powershell
Get-Content ".\in.txt" |
ForEach-Object { Get-ADUser -LDAPFilter "(mail=$_)" } |
Select-Object -ExpandProperty sAMAccountName |
Out-File ".\out.txt"

Keybase proof

I hereby claim:

  • I am matthewbodaly on github.
  • I am thejedi (https://keybase.io/thejedi) on keybase.
  • I have a public key whose fingerprint is 8980 4264 E5F3 3189 42DC 2548 98BD 3B2D DEA5 1D97

To claim this, I am signing this object:

@matthewbodaly
matthewbodaly / lastused.sh
Last active June 23, 2017 03:01
I needed to know how many days ago something was used for pro active license removal.
#!/bin/bash
# v1 - Matthew Bodaly
# There's probably a better way to do this
# I need to know how many days ago an application was used to determine if its worth keeping on a computer.
# I started here: https://www.jamf.com/jamf-nation/feature-requests/3361/application-usage-searchable-by-application This got me the mdls key
# I also used : https://stackoverflow.com/questions/3385003/shell-script-to-get-difference-in-two-dates
# I also used : https://www.jamf.com/jamf-nation/discussions/18058/extension-attribute-to-report-when-an-application-was-lasted-opened for error reporting
# I also realize that I'm being pretty lame about getting the first epoch exact and the second rounded to the date so the numbers aren't todally exact.
# Usage is pretty straight forward. If the application is installed and has been used at all, there will be a number. If the application is not installed, or there is an error, that is currently set to 0.
@matthewbodaly
matthewbodaly / randomnumberEA.sh
Last active October 1, 2020 01:00
Create an EA with Jamf to detect a random number
#!/bin/sh
result=`head -n 1 "/Library/Application Support/dt/digit.txt"`
echo "<result>$result</result>"
@matthewbodaly
matthewbodaly / o-chrome.mobileconfig
Last active January 21, 2017 05:48 — forked from opragel/o-chrome.mobileconfig
o-chrome.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.google.Chrome</key>
#/bin/bash
#ok. there are other ways to do this.
mkdir /Library/Application\ Support/pretendco/
sudo echo $((1 + RANDOM % 3)) > /Library/Application\ Support/pretentedco/digit.txt
@matthewbodaly
matthewbodaly / SIPstatus.sh
Created December 22, 2016 00:12
Use as an EA. You know what you must do.
#!/bin/bash
osvers_major=$(sw_vers -productVersion | awk -F. '{print $1}')
osvers_minor=$(sw_vers -productVersion | awk -F. '{print $2}')
# Checks to see if the OS on the Mac is 10.x.x. If it is not, the
# following message is displayed without quotes:
#
# "Unknown Version Of Mac OS X"