This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Simple python example of a Pashua password prompt window with a checkbox | |
# for saving the password to the keychain. None of it is wired up to | |
# actually function. It's just an example of what you can do. | |
# | |
# For easiest testing, you should have the Pashua.py connector and Pashua.app | |
# in the same directory as this script. | |
# | |
# The test password is 'password'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from re import findall | |
from subprocess import check_output | |
def getOrderedInterfaces(): | |
"""Returns all ethernet interfaces in service order.""" | |
interfaces = check_output(['networksetup', '-listnetworkserviceorder']) | |
matches = findall(r' en[\d]+', interfaces) | |
return [ i.lstrip(' ') for i in matches ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/pythonw | |
from Tkinter import Tk | |
from tkSimpleDialog import askstring | |
def passPrompt(title, prompt): | |
"""Prompts for a password.""" | |
password = askstring(title, prompt, show="*") | |
print "Seriously? '" + password + "'?? That's a lame password." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dscl /Search read /Users/$USER AuthenticationAuthority | egrep -o "[A-Z0-9._%+-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define hdfsstruct ($mountpoint = $name, $device) { | |
file { "$mountpoint": | |
ensure => directory, | |
} | |
exec { "format-$device": | |
command => "/sbin/mkfs.ext4 $device", | |
unless => "/bin/mount | /bin/grep $device", | |
refreshonly => true, | |
} | |
mount { $mountpoint: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class cluster::scratchroot { | |
file { '/scratch': | |
ensure => directory, | |
owner => 'root', | |
group => 'root', | |
mode => '0755', | |
} | |
} | |
define cluster::scratchdir( $u, $g, $m ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for vol in /Volumes/*; do | |
if [ -e "${vol}/System/Library/CoreServices/boot.efi" ]; then | |
echo "Partition info for Mac bootable volume:" | |
diskutil list "${vol}" | |
# more stuff here | |
elif [ -e "${vol}/Windows/System32/winload.exe" ]; then | |
echo "Partition info for Win bootable volume:" | |
diskutil list "${vol}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exec { 'patch_shellshock_security_hole': | |
command => "/usr/bin/yes | /usr/bin/yum update bash; touch /root/shellshock_bug_has_been_patched", | |
creates => '/root/shellshock_bug_has_been_patched', | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set testPass to text returned of (display dialog "Enter a test password:" default answer "" with hidden answer) | |
do shell script "/bin/echo '" & testPass & "' > /var/tmp/pass_file" | |
set echoedPass to (do shell script "/bin/cat /var/tmp/pass_file") | |
display dialog "This is what you typed: | |
" & testPass & " | |
This is what AppleScript echoed to a temp file: | |
" & echoedPass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
myLDAP=$(scutil --dns | awk '/nameserver\[0\]/{print $3}' | head -1) | |
mySearchBase=$(ldapsearch -LLL -Q -s base -H ldap://${myLDAP} defaultNamingContext | awk '/defaultNamingContext/{print $2}') | |
uAC=$(dscl localhost read /Search/Users/$USER userAccountControl | awk '/:userAccountControl:/{print $2}') | |
if [[ $uAC =~ ^6 ]]; then | |
passExpires="no" | |
else |